Skip to content

Commit

Permalink
auto merge of rust-lang#6635 : brson/rust/snapshot, r=brson
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed May 20, 2013
2 parents ab46a38 + 66319b0 commit 2e6cda2
Show file tree
Hide file tree
Showing 74 changed files with 24 additions and 9,844 deletions.
14 changes: 0 additions & 14 deletions src/libcore/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ pub mod rusti {
}

/// Casts the value at `src` to U. The two types must have the same length.
#[cfg(not(stage0))]
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
let mut dest: U = unstable::intrinsics::uninit();
{
let dest_ptr: *mut u8 = rusti::transmute(&mut dest);
let src_ptr: *u8 = rusti::transmute(src);
unstable::intrinsics::memmove64(dest_ptr,
src_ptr,
sys::size_of::<U>() as u64);
}
dest
}

#[cfg(stage0)]
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
let mut dest: U = unstable::intrinsics::init();
{
Expand Down
35 changes: 0 additions & 35 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
use option::{None, Option, Some};
use str;
#[cfg(stage0)]
use str::StrSlice;
#[cfg(not(stage0))]
use str::{StrSlice, OwnedStr};
use u32;
use uint;
Expand Down Expand Up @@ -191,21 +188,6 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
}
}

#[cfg(stage0)]
pub fn escape_unicode(c: char) -> ~str {
let s = u32::to_str_radix(c as u32, 16u);
let (c, pad) = (if c <= '\xff' { ('x', 2u) }
else if c <= '\uffff' { ('u', 4u) }
else { ('U', 8u) });
assert!(str::len(s) <= pad);
let mut out = ~"\\";
str::push_str(&mut out, str::from_char(c));
for uint::range(str::len(s), pad) |_i|
{ str::push_str(&mut out, ~"0"); }
str::push_str(&mut out, s);
out
}

///
/// Return the hexadecimal unicode escape of a char.
///
Expand All @@ -215,7 +197,6 @@ pub fn escape_unicode(c: char) -> ~str {
/// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
/// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
///
#[cfg(not(stage0))]
pub fn escape_unicode(c: char) -> ~str {
let s = u32::to_str_radix(c as u32, 16u);
let (c, pad) = cond!(
Expand Down Expand Up @@ -258,23 +239,7 @@ pub fn escape_default(c: char) -> ~str {
}
}

#[cfg(stage0)]
pub fn len_utf8_bytes(c: char) -> uint {
static max_one_b: uint = 128u;
static max_two_b: uint = 2048u;
static max_three_b: uint = 65536u;
static max_four_b: uint = 2097152u;

let code = c as uint;
if code < max_one_b { 1u }
else if code < max_two_b { 2u }
else if code < max_three_b { 3u }
else if code < max_four_b { 4u }
else { fail!("invalid character!") }
}

/// Returns the amount of bytes this character would need if encoded in utf8
#[cfg(not(stage0))]
pub fn len_utf8_bytes(c: char) -> uint {
static MAX_ONE_B: uint = 128u;
static MAX_TWO_B: uint = 2048u;
Expand Down
27 changes: 0 additions & 27 deletions src/libcore/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,33 +127,6 @@ struct AnnihilateStats {
n_bytes_freed: uint
}

#[cfg(stage0)]
unsafe fn each_live_alloc(read_next_before: bool,
f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
//! Walks the internal list of allocations
use managed;

let task: *Task = transmute(rustrt::rust_get_task());
let box = (*task).boxed_region.live_allocs;
let mut box: *mut BoxRepr = transmute(copy box);
while box != mut_null() {
let next_before = transmute(copy (*box).header.next);
let uniq =
(*box).header.ref_count == managed::raw::RC_MANAGED_UNIQUE;

if !f(box, uniq) {
return;
}

if read_next_before {
box = next_before;
} else {
box = transmute(copy (*box).header.next);
}
}
}
#[cfg(not(stage0))]
unsafe fn each_live_alloc(read_next_before: bool,
f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) -> bool {
//! Walks the internal list of allocations
Expand Down
53 changes: 0 additions & 53 deletions src/libcore/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,15 @@ pub trait Map<K, V>: Mutable {
fn contains_key(&self, key: &K) -> bool;

// Visits all keys and values
#[cfg(stage0)]
fn each<'a>(&'a self, f: &fn(&K, &'a V) -> bool);
// Visits all keys and values
#[cfg(not(stage0))]
fn each<'a>(&'a self, f: &fn(&K, &'a V) -> bool) -> bool;

/// Visit all keys
#[cfg(stage0)]
fn each_key(&self, f: &fn(&K) -> bool);
/// Visit all keys
#[cfg(not(stage0))]
fn each_key(&self, f: &fn(&K) -> bool) -> bool;

/// Visit all values
#[cfg(stage0)]
fn each_value<'a>(&'a self, f: &fn(&'a V) -> bool);
/// Visit all values
#[cfg(not(stage0))]
fn each_value<'a>(&'a self, f: &fn(&'a V) -> bool) -> bool;

/// Iterate over the map and mutate the contained values
#[cfg(stage0)]
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool);
/// Iterate over the map and mutate the contained values
#[cfg(not(stage0))]
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool) -> bool;

/// Return a reference to the value corresponding to the key
Expand All @@ -81,43 +65,6 @@ pub trait Map<K, V>: Mutable {
fn pop(&mut self, k: &K) -> Option<V>;
}

#[cfg(stage0)]
pub trait Set<T>: Mutable {
/// Return true if the set contains a value
fn contains(&self, value: &T) -> bool;

/// Add a value to the set. Return true if the value was not already
/// present in the set.
fn insert(&mut self, value: T) -> bool;

/// Remove a value from the set. Return true if the value was
/// present in the set.
fn remove(&mut self, value: &T) -> bool;

/// Return true if the set has no elements in common with `other`.
/// This is equivalent to checking for an empty intersection.
fn is_disjoint(&self, other: &Self) -> bool;

/// Return true if the set is a subset of another
fn is_subset(&self, other: &Self) -> bool;

/// Return true if the set is a superset of another
fn is_superset(&self, other: &Self) -> bool;

/// Visit the values representing the difference
fn difference(&self, other: &Self, f: &fn(&T) -> bool);

/// Visit the values representing the symmetric difference
fn symmetric_difference(&self, other: &Self, f: &fn(&T) -> bool);

/// Visit the values representing the intersection
fn intersection(&self, other: &Self, f: &fn(&T) -> bool);

/// Visit the values representing the union
fn union(&self, other: &Self, f: &fn(&T) -> bool);
}

#[cfg(not(stage0))]
pub trait Set<T>: Mutable {
/// Return true if the set contains a value
fn contains(&self, value: &T) -> bool;
Expand Down
10 changes: 0 additions & 10 deletions src/libcore/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ unsafe fn _walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) -> bool {
return true;
}

#[cfg(stage0)]
unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) {
_walk_safe_point(fp, sp, visitor);
}
#[cfg(not(stage0))]
unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) -> bool {
_walk_safe_point(fp, sp, visitor)
}
Expand Down Expand Up @@ -303,11 +298,6 @@ unsafe fn _walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) -> boo
return true;
}

#[cfg(stage0)]
unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
_walk_gc_roots(mem, sentinel, visitor);
}
#[cfg(not(stage0))]
unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) -> bool {
_walk_gc_roots(mem, sentinel, visitor)
}
Expand Down
10 changes: 0 additions & 10 deletions src/libcore/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* CPRNG like rand::rng.
*/

#[cfg(stage0)]
use cast;
use container::Container;
use old_iter::BaseIter;
use rt::io::Writer;
Expand Down Expand Up @@ -78,14 +76,6 @@ pub trait Streaming {
fn reset(&mut self);
}

// XXX: Ugly workaround for bootstrapping.
#[cfg(stage0)]
fn transmute_for_stage0<'a>(bytes: &'a [const u8]) -> &'a [u8] {
unsafe {
cast::transmute(bytes)
}
}
#[cfg(not(stage0))]
fn transmute_for_stage0<'a>(bytes: &'a [u8]) -> &'a [u8] {
bytes
}
Expand Down
Loading

0 comments on commit 2e6cda2

Please sign in to comment.