Skip to content

Commit 3bc4d1a

Browse files
AatchJames Miller
authored andcommitted
Remove all #[cfg(stage0)]-protected code
New snapshot means this can all go. Also removes places that have comments that say they are workarounds for stage0 errors.
1 parent 6759ce4 commit 3bc4d1a

File tree

20 files changed

+15
-369
lines changed

20 files changed

+15
-369
lines changed

src/libextra/num/complex.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ impl<T: Clone + Num> Cmplx<T> {
8080
}
8181
}
8282

83-
#[cfg(not(stage0))] // Fixed by #4228
8483
impl<T: Clone + Algebraic + Num> Cmplx<T> {
8584
/// Calculate |self|
8685
#[inline]
@@ -89,7 +88,6 @@ impl<T: Clone + Algebraic + Num> Cmplx<T> {
8988
}
9089
}
9190

92-
#[cfg(not(stage0))] // Fixed by #4228
9391
impl<T: Clone + Trigonometric + Algebraic + Num> Cmplx<T> {
9492
/// Calculate the principal Arg of self.
9593
#[inline]

src/libextra/std.rc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,10 @@ Rust extras are part of the standard Rust distribution.
3232
#[deny(non_camel_case_types)];
3333
#[deny(missing_doc)];
3434

35-
// NOTE: remove these two attributes after the next snapshot
36-
#[no_core]; // for stage0
37-
#[allow(unrecognized_lint)]; // otherwise stage0 is seriously ugly
38-
3935
#[no_std];
4036

4137
extern mod core(name = "std", vers = "0.7-pre");
4238

43-
#[cfg(stage0)]
44-
use core::{str, unstable};
4539
use core::str::{StrSlice, OwnedStr};
4640

4741
pub use core::os;

src/libextra/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
275275
let mut i = 0u;
276276
let len = strs.len();
277277
while i < len {
278-
match strs[i] { // can't use let due to stage0 bugs
278+
match strs[i] { // can't use let due to let-pattern bugs
279279
(ref needle, value) => {
280280
if match_str(ss, pos, *needle) {
281281
return Some((value, pos + needle.len()));

src/librustc/back/rpath.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,6 @@ pub fn get_absolute_rpath(lib: &Path) -> Path {
174174
os::make_absolute(lib).dir_path()
175175
}
176176

177-
#[cfg(stage0)]
178-
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
179-
let install_prefix = env!("CFG_PREFIX");
180-
181-
if install_prefix.is_empty() {
182-
fail!("rustc compiled without CFG_PREFIX environment variable");
183-
}
184-
185-
let tlib = filesearch::relative_target_lib_path(target_triple);
186-
os::make_absolute(&Path(install_prefix).push_rel(&tlib))
187-
}
188-
189-
#[cfg(not(stage0))]
190177
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
191178
let install_prefix = env!("CFG_PREFIX");
192179

src/librustc/driver/driver.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -521,25 +521,6 @@ pub fn build_target_config(sopts: @session::options,
521521
return target_cfg;
522522
}
523523
524-
#[cfg(stage0)]
525-
pub fn host_triple() -> ~str {
526-
// Get the host triple out of the build environment. This ensures that our
527-
// idea of the host triple is the same as for the set of libraries we've
528-
// actually built. We can't just take LLVM's host triple because they
529-
// normalize all ix86 architectures to i386.
530-
//
531-
// Instead of grabbing the host triple (for the current host), we grab (at
532-
// compile time) the target triple that this rustc is built with and
533-
// calling that (at runtime) the host triple.
534-
let ht = env!("CFG_COMPILER_TRIPLE");
535-
return if ht != ~"" {
536-
ht
537-
} else {
538-
fail!("rustc built without CFG_COMPILER_TRIPLE")
539-
};
540-
}
541-
542-
#[cfg(not(stage0))]
543524
pub fn host_triple() -> ~str {
544525
// Get the host triple out of the build environment. This ensures that our
545526
// idea of the host triple is the same as for the set of libraries we've

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,11 +749,7 @@ impl Liveness {
749749
None => {
750750
// Vanilla 'break' or 'loop', so use the enclosing
751751
// loop scope
752-
let len = { // FIXME(#5074) stage0
753-
let loop_scope = &mut *self.loop_scope;
754-
loop_scope.len()
755-
};
756-
if len == 0 {
752+
if self.loop_scope.len() == 0 {
757753
self.tcx.sess.span_bug(sp, "break outside loop");
758754
} else {
759755
// FIXME(#5275): this shouldn't have to be a method...

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ pub fn cleanup_and_leave(bcx: block,
13181318
match cur.kind {
13191319
block_scope(inf) if !inf.empty_cleanups() => {
13201320
let (sub_cx, dest, inf_cleanups) = {
1321-
let inf = &mut *inf; // FIXME(#5074) workaround stage0
1321+
let inf = &mut *inf;
13221322
let mut skip = 0;
13231323
let mut dest = None;
13241324
{

src/librustc/middle/typeck/check/vtable.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,9 @@ fn lookup_vtable(vcx: &VtableContext,
248248
// Nothing found. Continue.
249249
}
250250
Some(implementations) => {
251-
let len = { // FIXME(#5074): stage0 requires it
252-
let implementations: &mut ~[@Impl] = *implementations;
253-
implementations.len()
254-
};
255-
256251
// implementations is the list of all impls in scope for
257252
// trait_ref. (Usually, there's just one.)
258-
for uint::range(0, len) |i| {
259-
let im = implementations[i];
260-
253+
for implementations.iter().advance |im| {
261254
// im is one specific impl of trait_ref.
262255

263256
// First, ensure we haven't processed this impl yet.

src/librustc/middle/typeck/coherence.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,8 @@ impl CoherenceChecker {
520520

521521
match extension_methods.find(&trait_def_id) {
522522
Some(impls) => {
523-
let len = { // FIXME(#5074) stage0 requires this
524-
let impls: &mut ~[@Impl] = *impls;
525-
impls.len()
526-
};
527-
for uint::range(0, len) |i| {
528-
f(impls[i]);
523+
for impls.iter().advance |&im| {
524+
f(im);
529525
}
530526
}
531527
None => { /* no impls? */ }

src/librustc/rustc.rc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,8 @@ extern mod core(name = "std");
2828
extern mod extra(name = "extra");
2929
extern mod syntax;
3030

31-
// For deriving(Encodable) purposes...
32-
#[cfg(stage0)]
33-
extern mod std(name = "extra", vers = "0.7-pre");
34-
#[cfg(not(stage0))]
3531
extern mod std(name = "std", vers = "0.7-pre");
3632

37-
// For bootstrapping purposes.
38-
#[cfg(stage0)]
39-
pub use core::unstable;
40-
4133
use core::prelude::*;
4234

4335
use driver::driver::{host_triple, optgroups, early_error};

src/libstd/cast.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,8 @@ use sys;
1414
use unstable::intrinsics;
1515

1616
/// Casts the value at `src` to U. The two types must have the same length.
17-
#[cfg(stage0)]
18-
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
19-
let mut dest: U = intrinsics::uninit();
20-
{
21-
let dest_ptr: *mut u8 = transmute(&mut dest);
22-
let src_ptr: *u8 = transmute(src);
23-
intrinsics::memmove64(dest_ptr,
24-
src_ptr,
25-
sys::size_of::<U>() as u64);
26-
}
27-
dest
28-
}
29-
3017
/// Casts the value at `src` to U. The two types must have the same length.
31-
#[cfg(target_word_size = "32", not(stage0))]
18+
#[cfg(target_word_size = "32")]
3219
#[inline]
3320
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
3421
let mut dest: U = intrinsics::uninit();
@@ -39,7 +26,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
3926
}
4027

4128
/// Casts the value at `src` to U. The two types must have the same length.
42-
#[cfg(target_word_size = "64", not(stage0))]
29+
#[cfg(target_word_size = "64")]
4330
#[inline]
4431
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
4532
let mut dest: U = intrinsics::uninit();

src/libstd/core.rc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ they contained the following prologue:
5757
#[license = "MIT/ASL2"];
5858
#[crate_type = "lib"];
5959

60-
// NOTE: remove these two attributes after the next snapshot
61-
#[no_core]; // for stage0
62-
#[allow(unrecognized_lint)]; // otherwise stage0 is seriously ugly
63-
6460
// Don't link to std. We are std.
6561
#[no_std];
6662

src/libstd/io.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,9 +1654,7 @@ impl Writer for BytesWriter {
16541654
vec::reserve(bytes, count);
16551655

16561656
unsafe {
1657-
// Silly stage0 borrow check workaround...
1658-
let casted: &mut ~[u8] = cast::transmute_copy(&bytes);
1659-
vec::raw::set_len(casted, count);
1657+
vec::raw::set_len(bytes, count);
16601658

16611659
let view = vec::mut_slice(*bytes, *self.pos, count);
16621660
vec::bytes::copy_memory(view, v, v_len);

src/libstd/ptr.rs

Lines changed: 6 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,7 @@ pub fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) }
7575
* and destination may overlap.
7676
*/
7777
#[inline]
78-
#[cfg(target_word_size = "32", stage0)]
79-
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
80-
use unstable::intrinsics::memmove32;
81-
let n = count * sys::size_of::<T>();
82-
memmove32(dst as *mut u8, src as *u8, n as u32);
83-
}
84-
85-
/**
86-
* Copies data from one location to another.
87-
*
88-
* Copies `count` elements (not bytes) from `src` to `dst`. The source
89-
* and destination may overlap.
90-
*/
91-
#[inline]
92-
#[cfg(target_word_size = "32", not(stage0))]
78+
#[cfg(target_word_size = "32")]
9379
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
9480
use unstable::intrinsics::memmove32;
9581
memmove32(dst, src as *T, count as u32);
@@ -102,21 +88,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
10288
* and destination may overlap.
10389
*/
10490
#[inline]
105-
#[cfg(target_word_size = "64", stage0)]
106-
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
107-
use unstable::intrinsics::memmove64;
108-
let n = count * sys::size_of::<T>();
109-
memmove64(dst as *mut u8, src as *u8, n as u64);
110-
}
111-
112-
/**
113-
* Copies data from one location to another.
114-
*
115-
* Copies `count` elements (not bytes) from `src` to `dst`. The source
116-
* and destination may overlap.
117-
*/
118-
#[inline]
119-
#[cfg(target_word_size = "64", not(stage0))]
91+
#[cfg(target_word_size = "64")]
12092
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
12193
use unstable::intrinsics::memmove64;
12294
memmove64(dst, src as *T, count as u64);
@@ -129,21 +101,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
129101
* and destination may *not* overlap.
130102
*/
131103
#[inline]
132-
#[cfg(target_word_size = "32", stage0)]
133-
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
134-
use unstable::intrinsics::memmove32;
135-
let n = count * sys::size_of::<T>();
136-
memmove32(dst as *mut u8, src as *u8, n as u32);
137-
}
138-
139-
/**
140-
* Copies data from one location to another.
141-
*
142-
* Copies `count` elements (not bytes) from `src` to `dst`. The source
143-
* and destination may *not* overlap.
144-
*/
145-
#[inline]
146-
#[cfg(target_word_size = "32", not(stage0))]
104+
#[cfg(target_word_size = "32")]
147105
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
148106
use unstable::intrinsics::memcpy32;
149107
memcpy32(dst, src as *T, count as u32);
@@ -156,21 +114,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
156114
* and destination may *not* overlap.
157115
*/
158116
#[inline]
159-
#[cfg(target_word_size = "64", stage0)]
160-
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
161-
use unstable::intrinsics::memmove64;
162-
let n = count * sys::size_of::<T>();
163-
memmove64(dst as *mut u8, src as *u8, n as u64);
164-
}
165-
166-
/**
167-
* Copies data from one location to another.
168-
*
169-
* Copies `count` elements (not bytes) from `src` to `dst`. The source
170-
* and destination may *not* overlap.
171-
*/
172-
#[inline]
173-
#[cfg(target_word_size = "64", not(stage0))]
117+
#[cfg(target_word_size = "64")]
174118
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
175119
use unstable::intrinsics::memcpy64;
176120
memcpy64(dst, src as *T, count as u64);
@@ -181,7 +125,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
181125
* bytes of memory starting at `dst` to `c`.
182126
*/
183127
#[inline]
184-
#[cfg(target_word_size = "32", not(stage0))]
128+
#[cfg(target_word_size = "32")]
185129
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
186130
use unstable::intrinsics::memset32;
187131
memset32(dst, c, count as u32);
@@ -192,7 +136,7 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
192136
* bytes of memory starting at `dst` to `c`.
193137
*/
194138
#[inline]
195-
#[cfg(target_word_size = "64", not(stage0))]
139+
#[cfg(target_word_size = "64")]
196140
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
197141
use unstable::intrinsics::memset64;
198142
memset64(dst, c, count as u64);
@@ -592,7 +536,6 @@ pub mod ptr_tests {
592536
}
593537

594538
#[test]
595-
#[cfg(not(stage0))]
596539
fn test_set_memory() {
597540
let mut xs = [0u8, ..20];
598541
let ptr = vec::raw::to_mut_ptr(xs);

src/libstd/unstable/intrinsics.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,36 +130,23 @@ pub extern "rust-intrinsic" {
130130

131131
/// Equivalent to the `llvm.memcpy.p0i8.0i8.i32` intrinsic, with a size of
132132
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
133-
#[cfg(not(stage0))]
134133
pub fn memcpy32<T>(dst: *mut T, src: *T, count: u32);
135134
/// Equivalent to the `llvm.memcpy.p0i8.0i8.i64` intrinsic, with a size of
136135
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
137-
#[cfg(not(stage0))]
138136
pub fn memcpy64<T>(dst: *mut T, src: *T, count: u64);
139137

140-
/// Equivalent to the `llvm.memmove.p0i8.0i8.i32` intrinsic.
141-
#[cfg(stage0)]
142-
pub fn memmove32(dst: *mut u8, src: *u8, size: u32);
143-
/// Equivalent to the `llvm.memmove.p0i8.0i8.i64` intrinsic.
144-
#[cfg(stage0)]
145-
pub fn memmove64(dst: *mut u8, src: *u8, size: u64);
146-
147138
/// Equivalent to the `llvm.memmove.p0i8.0i8.i32` intrinsic, with a size of
148139
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
149-
#[cfg(not(stage0))]
150140
pub fn memmove32<T>(dst: *mut T, src: *T, count: u32);
151141
/// Equivalent to the `llvm.memmove.p0i8.0i8.i64` intrinsic, with a size of
152142
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
153-
#[cfg(not(stage0))]
154143
pub fn memmove64<T>(dst: *mut T, src: *T, count: u64);
155144

156145
/// Equivalent to the `llvm.memset.p0i8.i32` intrinsic, with a size of
157146
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
158-
#[cfg(not(stage0))]
159147
pub fn memset32<T>(dst: *mut T, val: u8, count: u32);
160148
/// Equivalent to the `llvm.memset.p0i8.i64` intrinsic, with a size of
161149
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
162-
#[cfg(not(stage0))]
163150
pub fn memset64<T>(dst: *mut T, val: u8, count: u64);
164151

165152
pub fn sqrtf32(x: f32) -> f32;

0 commit comments

Comments
 (0)