Skip to content

Commit 2e6cda2

Browse files
committed
auto merge of #6635 : brson/rust/snapshot, r=brson
2 parents ab46a38 + 66319b0 commit 2e6cda2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+24
-9844
lines changed

src/libcore/cast.rs

-14
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@ pub mod rusti {
2424
}
2525

2626
/// Casts the value at `src` to U. The two types must have the same length.
27-
#[cfg(not(stage0))]
28-
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
29-
let mut dest: U = unstable::intrinsics::uninit();
30-
{
31-
let dest_ptr: *mut u8 = rusti::transmute(&mut dest);
32-
let src_ptr: *u8 = rusti::transmute(src);
33-
unstable::intrinsics::memmove64(dest_ptr,
34-
src_ptr,
35-
sys::size_of::<U>() as u64);
36-
}
37-
dest
38-
}
39-
40-
#[cfg(stage0)]
4127
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
4228
let mut dest: U = unstable::intrinsics::init();
4329
{

src/libcore/char.rs

-35
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
1313
use option::{None, Option, Some};
1414
use str;
15-
#[cfg(stage0)]
16-
use str::StrSlice;
17-
#[cfg(not(stage0))]
1815
use str::{StrSlice, OwnedStr};
1916
use u32;
2017
use uint;
@@ -191,21 +188,6 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
191188
}
192189
}
193190

194-
#[cfg(stage0)]
195-
pub fn escape_unicode(c: char) -> ~str {
196-
let s = u32::to_str_radix(c as u32, 16u);
197-
let (c, pad) = (if c <= '\xff' { ('x', 2u) }
198-
else if c <= '\uffff' { ('u', 4u) }
199-
else { ('U', 8u) });
200-
assert!(str::len(s) <= pad);
201-
let mut out = ~"\\";
202-
str::push_str(&mut out, str::from_char(c));
203-
for uint::range(str::len(s), pad) |_i|
204-
{ str::push_str(&mut out, ~"0"); }
205-
str::push_str(&mut out, s);
206-
out
207-
}
208-
209191
///
210192
/// Return the hexadecimal unicode escape of a char.
211193
///
@@ -215,7 +197,6 @@ pub fn escape_unicode(c: char) -> ~str {
215197
/// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
216198
/// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
217199
///
218-
#[cfg(not(stage0))]
219200
pub fn escape_unicode(c: char) -> ~str {
220201
let s = u32::to_str_radix(c as u32, 16u);
221202
let (c, pad) = cond!(
@@ -258,23 +239,7 @@ pub fn escape_default(c: char) -> ~str {
258239
}
259240
}
260241

261-
#[cfg(stage0)]
262-
pub fn len_utf8_bytes(c: char) -> uint {
263-
static max_one_b: uint = 128u;
264-
static max_two_b: uint = 2048u;
265-
static max_three_b: uint = 65536u;
266-
static max_four_b: uint = 2097152u;
267-
268-
let code = c as uint;
269-
if code < max_one_b { 1u }
270-
else if code < max_two_b { 2u }
271-
else if code < max_three_b { 3u }
272-
else if code < max_four_b { 4u }
273-
else { fail!("invalid character!") }
274-
}
275-
276242
/// Returns the amount of bytes this character would need if encoded in utf8
277-
#[cfg(not(stage0))]
278243
pub fn len_utf8_bytes(c: char) -> uint {
279244
static MAX_ONE_B: uint = 128u;
280245
static MAX_TWO_B: uint = 2048u;

src/libcore/cleanup.rs

-27
Original file line numberDiff line numberDiff line change
@@ -127,33 +127,6 @@ struct AnnihilateStats {
127127
n_bytes_freed: uint
128128
}
129129

130-
#[cfg(stage0)]
131-
unsafe fn each_live_alloc(read_next_before: bool,
132-
f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
133-
//! Walks the internal list of allocations
134-
135-
use managed;
136-
137-
let task: *Task = transmute(rustrt::rust_get_task());
138-
let box = (*task).boxed_region.live_allocs;
139-
let mut box: *mut BoxRepr = transmute(copy box);
140-
while box != mut_null() {
141-
let next_before = transmute(copy (*box).header.next);
142-
let uniq =
143-
(*box).header.ref_count == managed::raw::RC_MANAGED_UNIQUE;
144-
145-
if !f(box, uniq) {
146-
return;
147-
}
148-
149-
if read_next_before {
150-
box = next_before;
151-
} else {
152-
box = transmute(copy (*box).header.next);
153-
}
154-
}
155-
}
156-
#[cfg(not(stage0))]
157130
unsafe fn each_live_alloc(read_next_before: bool,
158131
f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) -> bool {
159132
//! Walks the internal list of allocations

src/libcore/container.rs

-53
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,15 @@ pub trait Map<K, V>: Mutable {
3030
fn contains_key(&self, key: &K) -> bool;
3131

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

3935
/// Visit all keys
40-
#[cfg(stage0)]
41-
fn each_key(&self, f: &fn(&K) -> bool);
42-
/// Visit all keys
43-
#[cfg(not(stage0))]
4436
fn each_key(&self, f: &fn(&K) -> bool) -> bool;
4537

4638
/// Visit all values
47-
#[cfg(stage0)]
48-
fn each_value<'a>(&'a self, f: &fn(&'a V) -> bool);
49-
/// Visit all values
50-
#[cfg(not(stage0))]
5139
fn each_value<'a>(&'a self, f: &fn(&'a V) -> bool) -> bool;
5240

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

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

84-
#[cfg(stage0)]
85-
pub trait Set<T>: Mutable {
86-
/// Return true if the set contains a value
87-
fn contains(&self, value: &T) -> bool;
88-
89-
/// Add a value to the set. Return true if the value was not already
90-
/// present in the set.
91-
fn insert(&mut self, value: T) -> bool;
92-
93-
/// Remove a value from the set. Return true if the value was
94-
/// present in the set.
95-
fn remove(&mut self, value: &T) -> bool;
96-
97-
/// Return true if the set has no elements in common with `other`.
98-
/// This is equivalent to checking for an empty intersection.
99-
fn is_disjoint(&self, other: &Self) -> bool;
100-
101-
/// Return true if the set is a subset of another
102-
fn is_subset(&self, other: &Self) -> bool;
103-
104-
/// Return true if the set is a superset of another
105-
fn is_superset(&self, other: &Self) -> bool;
106-
107-
/// Visit the values representing the difference
108-
fn difference(&self, other: &Self, f: &fn(&T) -> bool);
109-
110-
/// Visit the values representing the symmetric difference
111-
fn symmetric_difference(&self, other: &Self, f: &fn(&T) -> bool);
112-
113-
/// Visit the values representing the intersection
114-
fn intersection(&self, other: &Self, f: &fn(&T) -> bool);
115-
116-
/// Visit the values representing the union
117-
fn union(&self, other: &Self, f: &fn(&T) -> bool);
118-
}
119-
120-
#[cfg(not(stage0))]
12168
pub trait Set<T>: Mutable {
12269
/// Return true if the set contains a value
12370
fn contains(&self, value: &T) -> bool;

src/libcore/gc.rs

-10
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ unsafe fn _walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) -> bool {
171171
return true;
172172
}
173173

174-
#[cfg(stage0)]
175-
unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) {
176-
_walk_safe_point(fp, sp, visitor);
177-
}
178-
#[cfg(not(stage0))]
179174
unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) -> bool {
180175
_walk_safe_point(fp, sp, visitor)
181176
}
@@ -303,11 +298,6 @@ unsafe fn _walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) -> boo
303298
return true;
304299
}
305300

306-
#[cfg(stage0)]
307-
unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
308-
_walk_gc_roots(mem, sentinel, visitor);
309-
}
310-
#[cfg(not(stage0))]
311301
unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) -> bool {
312302
_walk_gc_roots(mem, sentinel, visitor)
313303
}

src/libcore/hash.rs

-10
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
* CPRNG like rand::rng.
2020
*/
2121

22-
#[cfg(stage0)]
23-
use cast;
2422
use container::Container;
2523
use old_iter::BaseIter;
2624
use rt::io::Writer;
@@ -78,14 +76,6 @@ pub trait Streaming {
7876
fn reset(&mut self);
7977
}
8078

81-
// XXX: Ugly workaround for bootstrapping.
82-
#[cfg(stage0)]
83-
fn transmute_for_stage0<'a>(bytes: &'a [const u8]) -> &'a [u8] {
84-
unsafe {
85-
cast::transmute(bytes)
86-
}
87-
}
88-
#[cfg(not(stage0))]
8979
fn transmute_for_stage0<'a>(bytes: &'a [u8]) -> &'a [u8] {
9080
bytes
9181
}

0 commit comments

Comments
 (0)