about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-08-12 17:25:14 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-08-12 17:37:46 -0400
commit0cb0ef2ca5e4c0694f12ff1ca7d0a59d789b795b (patch)
treed4400a81aaad9d6ff59b90e9f4328cba67f6b465
parent8b502d60abf582e799aa7390cb9b8ab2b4465e65 (diff)
downloadrust-0cb0ef2ca5e4c0694f12ff1ca7d0a59d789b795b.tar.gz
rust-0cb0ef2ca5e4c0694f12ff1ca7d0a59d789b795b.zip
fix build with the new snapshot compiler
-rw-r--r--src/libextra/terminfo/parm.rs97
-rw-r--r--src/librustc/back/rpath.rs13
-rw-r--r--src/librustc/driver/driver.rs19
-rw-r--r--src/librustc/metadata/filesearch.rs10
-rw-r--r--src/librustc/rustc.rs10
-rw-r--r--src/libstd/cast.rs10
-rw-r--r--src/libstd/io.rs14
-rw-r--r--src/libstd/num/num.rs51
-rw-r--r--src/libstd/ptr.rs22
-rw-r--r--src/libstd/repr.rs24
-rw-r--r--src/libstd/str.rs428
-rw-r--r--src/libstd/str/ascii.rs37
-rw-r--r--src/libstd/unstable/intrinsics.rs29
13 files changed, 16 insertions, 748 deletions
diff --git a/src/libextra/terminfo/parm.rs b/src/libextra/terminfo/parm.rs
index bb59e34f98a..10f1b330c5b 100644
--- a/src/libextra/terminfo/parm.rs
+++ b/src/libextra/terminfo/parm.rs
@@ -475,103 +475,6 @@ impl FormatOp {
     }
 }
 
-#[cfg(stage0)]
-fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
-    let mut s = match val {
-        Number(d) => {
-            match op {
-                FormatString => {
-                    return Err(~"non-number on stack with %s")
-                }
-                _ => {
-                    let radix = match op {
-                        FormatDigit => 10,
-                        FormatOctal => 8,
-                        FormatHex|FormatHEX => 16,
-                        FormatString => util::unreachable()
-                    };
-                    let mut s = ~[];
-                    match op {
-                        FormatDigit => {
-                            let sign = if flags.sign { SignAll } else { SignNeg };
-                            do int_to_str_bytes_common(d, radix, sign) |c| {
-                                s.push(c);
-                            }
-                        }
-                        _ => {
-                            do int_to_str_bytes_common(d as uint, radix, SignNone) |c| {
-                                s.push(c);
-                            }
-                        }
-                    };
-                    if flags.precision > s.len() {
-                        let mut s_ = vec::with_capacity(flags.precision);
-                        let n = flags.precision - s.len();
-                        s_.grow(n, &('0' as u8));
-                        s_.push_all_move(s);
-                        s = s_;
-                    }
-                    assert!(!s.is_empty(), "string conversion produced empty result");
-                    match op {
-                        FormatDigit => {
-                            if flags.space && !(s[0] == '-' as u8 || s[0] == '+' as u8) {
-                                s.unshift(' ' as u8);
-                            }
-                        }
-                        FormatOctal => {
-                            if flags.alternate && s[0] != '0' as u8 {
-                                s.unshift('0' as u8);
-                            }
-                        }
-                        FormatHex => {
-                            if flags.alternate {
-                                let s_ = util::replace(&mut s, ~['0' as u8, 'x' as u8]);
-                                s.push_all_move(s_);
-                            }
-                        }
-                        FormatHEX => {
-                            s = s.into_ascii().to_upper().into_bytes();
-                            if flags.alternate {
-                                let s_ = util::replace(&mut s, ~['0' as u8, 'X' as u8]);
-                                s.push_all_move(s_);
-                            }
-                        }
-                        FormatString => util::unreachable()
-                    }
-                    s
-                }
-            }
-        }
-        String(s) => {
-            match op {
-                FormatString => {
-                    let mut s = s.as_bytes().to_owned();
-                    if flags.precision > 0 && flags.precision < s.len() {
-                        s.truncate(flags.precision);
-                    }
-                    s
-                }
-                _ => {
-                    return Err(fmt!("non-string on stack with %%%c", op.to_char()))
-                }
-            }
-        }
-    };
-    if flags.width > s.len() {
-        let n = flags.width - s.len();
-        if flags.left {
-            s.grow(n, &(' ' as u8));
-        } else {
-            let mut s_ = vec::with_capacity(flags.width);
-            s_.grow(n, &(' ' as u8));
-            s_.push_all_move(s);
-            s = s_;
-        }
-    }
-    Ok(s)
-}
-
-#[cfg(not(stage0))]
 fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
     let mut s = match val {
         Number(d) => {
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index e7706815ff5..22ed0b3cf3c 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -130,19 +130,6 @@ pub fn get_absolute_rpath(lib: &Path) -> Path {
     os::make_absolute(lib).dir_path()
 }
 
-#[cfg(stage0)]
-pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
-    let install_prefix = env!("CFG_PREFIX");
-
-    if install_prefix == "" {
-        fail!("rustc compiled without CFG_PREFIX environment variable");
-    }
-
-    let tlib = filesearch::relative_target_lib_path(target_triple);
-    os::make_absolute(&Path(install_prefix).push_rel(&tlib))
-}
-
-#[cfg(not(stage0))]
 pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
     let install_prefix = env!("CFG_PREFIX");
 
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index aa759bc821a..ca2e33b6a6d 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -578,25 +578,6 @@ pub fn build_target_config(sopts: @session::options,
     return target_cfg;
 }
 
-#[cfg(stage0)]
-pub fn host_triple() -> ~str {
-    // Get the host triple out of the build environment. This ensures that our
-    // idea of the host triple is the same as for the set of libraries we've
-    // actually built.  We can't just take LLVM's host triple because they
-    // normalize all ix86 architectures to i386.
-    //
-    // Instead of grabbing the host triple (for the current host), we grab (at
-    // compile time) the target triple that this rustc is built with and
-    // calling that (at runtime) the host triple.
-    let ht = env!("CFG_COMPILER_TRIPLE");
-    return if ht != "" {
-            ht.to_owned()
-        } else {
-            fail!("rustc built without CFG_COMPILER_TRIPLE")
-        };
-}
-
-#[cfg(not(stage0))]
 pub fn host_triple() -> ~str {
     // Get the host triple out of the build environment. This ensures that our
     // idea of the host triple is the same as for the set of libraries we've
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 56200a221be..33d517f3981 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -200,16 +200,6 @@ fn push_if_exists(vec: &mut ~[Path], p: &Path) {
 
 // The name of the directory rustc expects libraries to be located.
 // On Unix should be "lib", on windows "bin"
-#[cfg(stage0)]
-pub fn libdir() -> ~str {
-   let libdir = env!("CFG_LIBDIR");
-   if libdir.is_empty() {
-      fail!("rustc compiled without CFG_LIBDIR environment variable");
-   }
-   libdir.to_owned()
-}
-
-#[cfg(not(stage0))]
 pub fn libdir() -> ~str {
     (env!("CFG_LIBDIR")).to_owned()
 }
diff --git a/src/librustc/rustc.rs b/src/librustc/rustc.rs
index ec80d1a44ea..195ff0dc6b6 100644
--- a/src/librustc/rustc.rs
+++ b/src/librustc/rustc.rs
@@ -117,16 +117,6 @@ mod std {
 }
 */
 
-#[cfg(stage0)]
-pub fn version(argv0: &str) {
-    let mut vers = ~"unknown version";
-    let env_vers = env!("CFG_VERSION");
-    if env_vers.len() != 0 { vers = env_vers.to_owned(); }
-    printfln!("%s %s", argv0, vers);
-    printfln!("host: %s", host_triple());
-}
-
-#[cfg(not(stage0))]
 pub fn version(argv0: &str) {
     let vers = match option_env!("CFG_VERSION") {
         Some(vers) => vers,
diff --git a/src/libstd/cast.rs b/src/libstd/cast.rs
index ff9057afb55..9d1d6e65901 100644
--- a/src/libstd/cast.rs
+++ b/src/libstd/cast.rs
@@ -165,20 +165,10 @@ mod tests {
         }
     }
 
-    #[cfg(stage0)]
-    #[test]
-    fn test_transmute2() {
-        unsafe {
-            assert_eq!(~[76u8, 0u8], transmute(~"L"));
-        }
-    }
-
-    #[cfg(not(stage0))]
     #[test]
     fn test_transmute2() {
         unsafe {
             assert_eq!(~[76u8], transmute(~"L"));
         }
     }
-
 }
diff --git a/src/libstd/io.rs b/src/libstd/io.rs
index 07572d60917..2c18bd272e8 100644
--- a/src/libstd/io.rs
+++ b/src/libstd/io.rs
@@ -1707,20 +1707,6 @@ pub fn with_bytes_writer(f: &fn(@Writer)) -> ~[u8] {
     (*bytes).clone()
 }
 
-#[cfg(stage0)]
-pub fn with_str_writer(f: &fn(@Writer)) -> ~str {
-    let mut v = with_bytes_writer(f);
-
-    // Make sure the vector has a trailing null and is proper utf8.
-    v.push(0);
-    assert!(str::is_utf8(v));
-
-    unsafe {
-        ::cast::transmute(v)
-    }
-}
-
-#[cfg(not(stage0))]
 pub fn with_str_writer(f: &fn(@Writer)) -> ~str {
     str::from_bytes(with_bytes_writer(f))
 }
diff --git a/src/libstd/num/num.rs b/src/libstd/num/num.rs
index 62452a4edff..3af1666b4da 100644
--- a/src/libstd/num/num.rs
+++ b/src/libstd/num/num.rs
@@ -19,7 +19,6 @@ use cmp::{Eq, ApproxEq, Ord};
 use ops::{Add, Sub, Mul, Div, Rem, Neg};
 use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr};
 use option::{Option, Some, None};
-#[cfg(not(stage0))]
 use unstable::intrinsics;
 
 pub mod strconv;
@@ -522,7 +521,6 @@ pub trait CheckedAdd: Add<Self, Self> {
     fn checked_add(&self, v: &Self) -> Option<Self>;
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for i8 {
     #[inline]
     fn checked_add(&self, v: &i8) -> Option<i8> {
@@ -533,7 +531,6 @@ impl CheckedAdd for i8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for i16 {
     #[inline]
     fn checked_add(&self, v: &i16) -> Option<i16> {
@@ -544,7 +541,6 @@ impl CheckedAdd for i16 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for i32 {
     #[inline]
     fn checked_add(&self, v: &i32) -> Option<i32> {
@@ -555,7 +551,6 @@ impl CheckedAdd for i32 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for i64 {
     #[inline]
     fn checked_add(&self, v: &i64) -> Option<i64> {
@@ -566,7 +561,7 @@ impl CheckedAdd for i64 {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "32")]
+#[cfg(target_word_size = "32")]
 impl CheckedAdd for int {
     #[inline]
     fn checked_add(&self, v: &int) -> Option<int> {
@@ -577,7 +572,7 @@ impl CheckedAdd for int {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedAdd for int {
     #[inline]
     fn checked_add(&self, v: &int) -> Option<int> {
@@ -588,7 +583,6 @@ impl CheckedAdd for int {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for u8 {
     #[inline]
     fn checked_add(&self, v: &u8) -> Option<u8> {
@@ -599,7 +593,6 @@ impl CheckedAdd for u8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for u16 {
     #[inline]
     fn checked_add(&self, v: &u16) -> Option<u16> {
@@ -610,7 +603,6 @@ impl CheckedAdd for u16 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for u32 {
     #[inline]
     fn checked_add(&self, v: &u32) -> Option<u32> {
@@ -621,7 +613,6 @@ impl CheckedAdd for u32 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedAdd for u64 {
     #[inline]
     fn checked_add(&self, v: &u64) -> Option<u64> {
@@ -632,7 +623,7 @@ impl CheckedAdd for u64 {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "32")]
+#[cfg(target_word_size = "32")]
 impl CheckedAdd for uint {
     #[inline]
     fn checked_add(&self, v: &uint) -> Option<uint> {
@@ -643,7 +634,7 @@ impl CheckedAdd for uint {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedAdd for uint {
     #[inline]
     fn checked_add(&self, v: &uint) -> Option<uint> {
@@ -658,7 +649,6 @@ pub trait CheckedSub: Sub<Self, Self> {
     fn checked_sub(&self, v: &Self) -> Option<Self>;
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for i8 {
     #[inline]
     fn checked_sub(&self, v: &i8) -> Option<i8> {
@@ -669,7 +659,6 @@ impl CheckedSub for i8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for i16 {
     #[inline]
     fn checked_sub(&self, v: &i16) -> Option<i16> {
@@ -680,7 +669,6 @@ impl CheckedSub for i16 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for i32 {
     #[inline]
     fn checked_sub(&self, v: &i32) -> Option<i32> {
@@ -691,7 +679,6 @@ impl CheckedSub for i32 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for i64 {
     #[inline]
     fn checked_sub(&self, v: &i64) -> Option<i64> {
@@ -702,7 +689,7 @@ impl CheckedSub for i64 {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "32")]
+#[cfg(target_word_size = "32")]
 impl CheckedSub for int {
     #[inline]
     fn checked_sub(&self, v: &int) -> Option<int> {
@@ -713,7 +700,7 @@ impl CheckedSub for int {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedSub for int {
     #[inline]
     fn checked_sub(&self, v: &int) -> Option<int> {
@@ -724,7 +711,6 @@ impl CheckedSub for int {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for u8 {
     #[inline]
     fn checked_sub(&self, v: &u8) -> Option<u8> {
@@ -735,7 +721,6 @@ impl CheckedSub for u8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for u16 {
     #[inline]
     fn checked_sub(&self, v: &u16) -> Option<u16> {
@@ -746,7 +731,6 @@ impl CheckedSub for u16 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for u32 {
     #[inline]
     fn checked_sub(&self, v: &u32) -> Option<u32> {
@@ -757,7 +741,6 @@ impl CheckedSub for u32 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedSub for u64 {
     #[inline]
     fn checked_sub(&self, v: &u64) -> Option<u64> {
@@ -768,7 +751,7 @@ impl CheckedSub for u64 {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "32")]
+#[cfg(target_word_size = "32")]
 impl CheckedSub for uint {
     #[inline]
     fn checked_sub(&self, v: &uint) -> Option<uint> {
@@ -779,7 +762,7 @@ impl CheckedSub for uint {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedSub for uint {
     #[inline]
     fn checked_sub(&self, v: &uint) -> Option<uint> {
@@ -794,7 +777,6 @@ pub trait CheckedMul: Mul<Self, Self> {
     fn checked_mul(&self, v: &Self) -> Option<Self>;
 }
 
-#[cfg(not(stage0))]
 impl CheckedMul for i8 {
     #[inline]
     fn checked_mul(&self, v: &i8) -> Option<i8> {
@@ -805,7 +787,6 @@ impl CheckedMul for i8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedMul for i16 {
     #[inline]
     fn checked_mul(&self, v: &i16) -> Option<i16> {
@@ -816,7 +797,6 @@ impl CheckedMul for i16 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedMul for i32 {
     #[inline]
     fn checked_mul(&self, v: &i32) -> Option<i32> {
@@ -828,7 +808,7 @@ impl CheckedMul for i32 {
 }
 
 // FIXME: #8449: should not be disabled on 32-bit
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedMul for i64 {
     #[inline]
     fn checked_mul(&self, v: &i64) -> Option<i64> {
@@ -839,7 +819,7 @@ impl CheckedMul for i64 {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "32")]
+#[cfg(target_word_size = "32")]
 impl CheckedMul for int {
     #[inline]
     fn checked_mul(&self, v: &int) -> Option<int> {
@@ -850,7 +830,7 @@ impl CheckedMul for int {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedMul for int {
     #[inline]
     fn checked_mul(&self, v: &int) -> Option<int> {
@@ -861,7 +841,6 @@ impl CheckedMul for int {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedMul for u8 {
     #[inline]
     fn checked_mul(&self, v: &u8) -> Option<u8> {
@@ -872,7 +851,6 @@ impl CheckedMul for u8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedMul for u16 {
     #[inline]
     fn checked_mul(&self, v: &u16) -> Option<u16> {
@@ -883,7 +861,6 @@ impl CheckedMul for u16 {
     }
 }
 
-#[cfg(not(stage0))]
 impl CheckedMul for u32 {
     #[inline]
     fn checked_mul(&self, v: &u32) -> Option<u32> {
@@ -895,7 +872,7 @@ impl CheckedMul for u32 {
 }
 
 // FIXME: #8449: should not be disabled on 32-bit
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedMul for u64 {
     #[inline]
     fn checked_mul(&self, v: &u64) -> Option<u64> {
@@ -906,7 +883,7 @@ impl CheckedMul for u64 {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "32")]
+#[cfg(target_word_size = "32")]
 impl CheckedMul for uint {
     #[inline]
     fn checked_mul(&self, v: &uint) -> Option<uint> {
@@ -917,7 +894,7 @@ impl CheckedMul for uint {
     }
 }
 
-#[cfg(not(stage0), target_word_size = "64")]
+#[cfg(target_word_size = "64")]
 impl CheckedMul for uint {
     #[inline]
     fn checked_mul(&self, v: &uint) -> Option<uint> {
diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs
index 26653a51d66..96f3e480617 100644
--- a/src/libstd/ptr.rs
+++ b/src/libstd/ptr.rs
@@ -309,15 +309,6 @@ impl<T> RawPtr<T> for *T {
     /// Calculates the offset from a pointer. The offset *must* be in-bounds of
     /// the object, or one-byte-past-the-end.
     #[inline]
-    #[cfg(stage0)]
-    unsafe fn offset_inbounds(self, count: int) -> *T {
-        intrinsics::offset(self, count)
-    }
-
-    /// Calculates the offset from a pointer. The offset *must* be in-bounds of
-    /// the object, or one-byte-past-the-end.
-    #[inline]
-    #[cfg(not(stage0))]
     unsafe fn offset_inbounds(self, count: int) -> *T {
         intrinsics::offset_inbounds(self, count)
     }
@@ -361,19 +352,6 @@ impl<T> RawPtr<T> for *mut T {
     /// This method should be preferred over `offset` when the guarantee can be
     /// satisfied, to enable better optimization.
     #[inline]
-    #[cfg(stage0)]
-    unsafe fn offset_inbounds(self, count: int) -> *mut T {
-        intrinsics::offset(self as *T, count) as *mut T
-    }
-
-    /// Calculates the offset from a pointer. The offset *must* be in-bounds of
-    /// the object, or one-byte-past-the-end. An arithmetic overflow is also
-    /// undefined behaviour.
-    ///
-    /// This method should be preferred over `offset` when the guarantee can be
-    /// satisfied, to enable better optimization.
-    #[inline]
-    #[cfg(not(stage0))]
     unsafe fn offset_inbounds(self, count: int) -> *mut T {
         intrinsics::offset_inbounds(self as *T, count) as *mut T
     }
diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs
index d0970f1b6b7..743a47a812a 100644
--- a/src/libstd/repr.rs
+++ b/src/libstd/repr.rs
@@ -158,18 +158,6 @@ impl ReprVisitor {
     }
 
     #[inline]
-    #[cfg(stage0)]
-    pub fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool {
-        unsafe {
-            let u = ReprVisitor(ptr, self.writer);
-            let v = reflect::MovePtrAdaptor(u);
-            visit_tydesc(inner, @v as @TyVisitor);
-            true
-        }
-    }
-
-    #[inline]
-    #[cfg(not(stage0))]
     pub fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool {
         unsafe {
             let u = ReprVisitor(ptr, self.writer);
@@ -568,18 +556,6 @@ impl TyVisitor for ReprVisitor {
     fn visit_closure_ptr(&self, _ck: uint) -> bool { true }
 }
 
-#[cfg(stage0)]
-pub fn write_repr<T>(writer: @Writer, object: &T) {
-    unsafe {
-        let ptr = ptr::to_unsafe_ptr(object) as *c_void;
-        let tydesc = get_tydesc::<T>();
-        let u = ReprVisitor(ptr, writer);
-        let v = reflect::MovePtrAdaptor(u);
-        visit_tydesc(tydesc, @v as @TyVisitor)
-    }
-}
-
-#[cfg(not(stage0))]
 pub fn write_repr<T>(writer: @Writer, object: &T) {
     unsafe {
         let ptr = ptr::to_unsafe_ptr(object) as *c_void;
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 0b270edc534..9e5f2db4092 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -33,8 +33,6 @@ use ptr;
 use ptr::RawPtr;
 use to_str::ToStr;
 use uint;
-#[cfg(stage0)]
-use unstable::raw::Repr;
 use vec;
 use vec::{OwnedVector, OwnedCopyableVector, ImmutableVector, MutableVector};
 
@@ -92,25 +90,6 @@ pub fn from_bytes_owned(vv: ~[u8]) -> ~str {
 /// # Failure
 ///
 /// Fails if invalid UTF-8
-#[cfg(stage0)]
-pub fn from_bytes_slice<'a>(vector: &'a [u8]) -> &'a str {
-    unsafe {
-        assert!(is_utf8(vector));
-        let mut s = vector.repr();
-        s.len += 1;
-        cast::transmute(s)
-    }
-}
-
-/// Converts a vector to a string slice without performing any allocations.
-///
-/// Once the slice has been validated as utf-8, it is transmuted in-place and
-/// returned as a '&str' instead of a '&[u8]'
-///
-/// # Failure
-///
-/// Fails if invalid UTF-8
-#[cfg(not(stage0))]
 pub fn from_bytes_slice<'a>(v: &'a [u8]) -> &'a str {
     assert!(is_utf8(v));
     unsafe { cast::transmute(v) }
@@ -134,18 +113,6 @@ impl ToStr for @str {
 /// # Failure
 ///
 /// Fails if invalid UTF-8
-#[cfg(stage0)]
-pub fn from_byte(b: u8) -> ~str {
-    assert!(b < 128u8);
-    unsafe { cast::transmute(~[b, 0u8]) }
-}
-
-/// Convert a byte to a UTF-8 string
-///
-/// # Failure
-///
-/// Fails if invalid UTF-8
-#[cfg(not(stage0))]
 pub fn from_byte(b: u8) -> ~str {
     assert!(b < 128u8);
     unsafe { ::cast::transmute(~[b]) }
@@ -181,32 +148,6 @@ pub trait StrVector {
 
 impl<'self, S: Str> StrVector for &'self [S] {
     /// Concatenate a vector of strings.
-    #[cfg(stage0)]
-    pub fn concat(&self) -> ~str {
-        if self.is_empty() { return ~""; }
-
-        let len = self.iter().map(|s| s.as_slice().len()).sum();
-
-        let mut s = with_capacity(len);
-
-        unsafe {
-            do s.as_mut_buf |buf, _| {
-                let mut buf = buf;
-                for ss in self.iter() {
-                    do ss.as_slice().as_imm_buf |ssbuf, sslen| {
-                        let sslen = sslen - 1;
-                        ptr::copy_memory(buf, ssbuf, sslen);
-                        buf = buf.offset(sslen as int);
-                    }
-                }
-            }
-            raw::set_len(&mut s, len);
-        }
-        s
-    }
-
-    /// Concatenate a vector of strings.
-    #[cfg(not(stage0))]
     pub fn concat(&self) -> ~str {
         if self.is_empty() { return ~""; }
 
@@ -230,48 +171,6 @@ impl<'self, S: Str> StrVector for &'self [S] {
     }
 
     /// Concatenate a vector of strings, placing a given separator between each.
-    #[cfg(stage0)]
-    pub fn connect(&self, sep: &str) -> ~str {
-        if self.is_empty() { return ~""; }
-
-        // concat is faster
-        if sep.is_empty() { return self.concat(); }
-
-        // this is wrong without the guarantee that `self` is non-empty
-        let len = sep.len() * (self.len() - 1)
-            + self.iter().map(|s| s.as_slice().len()).sum();
-        let mut s = ~"";
-        let mut first = true;
-
-        s.reserve(len);
-
-        unsafe {
-            do s.as_mut_buf |buf, _| {
-                do sep.as_imm_buf |sepbuf, seplen| {
-                    let seplen = seplen - 1;
-                    let mut buf = cast::transmute_mut_unsafe(buf);
-                    for ss in self.iter() {
-                        do ss.as_slice().as_imm_buf |ssbuf, sslen| {
-                            let sslen = sslen - 1;
-                            if first {
-                                first = false;
-                            } else {
-                                ptr::copy_memory(buf, sepbuf, seplen);
-                                buf = buf.offset(seplen as int);
-                            }
-                            ptr::copy_memory(buf, ssbuf, sslen);
-                            buf = buf.offset(sslen as int);
-                        }
-                    }
-                }
-            }
-            raw::set_len(&mut s, len);
-        }
-        s
-    }
-
-    /// Concatenate a vector of strings, placing a given separator between each.
-    #[cfg(not(stage0))]
     pub fn connect(&self, sep: &str) -> ~str {
         if self.is_empty() { return ~""; }
 
@@ -578,26 +477,7 @@ Section: Comparing strings
 */
 
 /// Bytewise slice equality
-#[cfg(not(test), stage0)]
-#[lang="str_eq"]
-#[inline]
-pub fn eq_slice(a: &str, b: &str) -> bool {
-    do a.as_imm_buf |ap, alen| {
-        do b.as_imm_buf |bp, blen| {
-            if (alen != blen) { false }
-            else {
-                unsafe {
-                    libc::memcmp(ap as *libc::c_void,
-                                 bp as *libc::c_void,
-                                 (alen - 1) as libc::size_t) == 0
-                }
-            }
-        }
-    }
-}
-
-/// Bytewise slice equality
-#[cfg(not(test), not(stage0))]
+#[cfg(not(test))]
 #[lang="str_eq"]
 #[inline]
 pub fn eq_slice(a: &str, b: &str) -> bool {
@@ -616,26 +496,7 @@ pub fn eq_slice(a: &str, b: &str) -> bool {
 }
 
 /// Bytewise slice equality
-#[cfg(test, stage0)]
-#[lang="str_eq"]
-#[inline]
-pub fn eq_slice(a: &str, b: &str) -> bool {
-    do a.as_imm_buf |ap, alen| {
-        do b.as_imm_buf |bp, blen| {
-            if (alen != blen) { false }
-            else {
-                unsafe {
-                    libc::memcmp(ap as *libc::c_void,
-                                 bp as *libc::c_void,
-                                 (alen - 1) as libc::size_t) == 0
-                }
-            }
-        }
-    }
-}
-
-/// Bytewise slice equality
-#[cfg(test, not(stage0))]
+#[cfg(test)]
 #[inline]
 pub fn eq_slice(a: &str, b: &str) -> bool {
     do a.as_imm_buf |ap, alen| {
@@ -807,17 +668,6 @@ pub fn from_utf16(v: &[u16]) -> ~str {
 
 /// Allocates a new string with the specified capacity. The string returned is
 /// the empty string, but has capacity for much more.
-#[cfg(stage0)]
-#[inline]
-pub fn with_capacity(capacity: uint) -> ~str {
-    let mut buf = ~"";
-    buf.reserve(capacity);
-    buf
-}
-
-/// Allocates a new string with the specified capacity. The string returned is
-/// the empty string, but has capacity for much more.
-#[cfg(not(stage0))]
 #[inline]
 pub fn with_capacity(capacity: uint) -> ~str {
     unsafe {
@@ -929,25 +779,8 @@ pub mod raw {
     use vec;
     use vec::MutableVector;
     use unstable::raw::Slice;
-    #[cfg(stage0)]
-    use unstable::raw::String;
 
     /// Create a Rust string from a *u8 buffer of the given length
-    #[cfg(stage0)]
-    pub unsafe fn from_buf_len(buf: *u8, len: uint) -> ~str {
-        let mut v: ~[u8] = vec::with_capacity(len + 1);
-        v.as_mut_buf(|vbuf, _len| {
-            ptr::copy_memory(vbuf, buf as *u8, len)
-        });
-        vec::raw::set_len(&mut v, len);
-        v.push(0u8);
-
-        assert!(is_utf8(v));
-        cast::transmute(v)
-    }
-
-    /// Create a Rust string from a *u8 buffer of the given length
-    #[cfg(not(stage0))]
     pub unsafe fn from_buf_len(buf: *u8, len: uint) -> ~str {
         let mut v: ~[u8] = vec::with_capacity(len);
         do v.as_mut_buf |vbuf, _len| {
@@ -987,15 +820,6 @@ pub mod raw {
 
     /// Converts an owned vector of bytes to a new owned string. This assumes
     /// that the utf-8-ness of the vector has already been validated
-    #[cfg(stage0)]
-    pub unsafe fn from_bytes_owned(mut v: ~[u8]) -> ~str {
-        v.push(0u8);
-        cast::transmute(v)
-    }
-
-    /// Converts an owned vector of bytes to a new owned string. This assumes
-    /// that the utf-8-ness of the vector has already been validated
-    #[cfg(not(stage0))]
     #[inline]
     pub unsafe fn from_bytes_owned(v: ~[u8]) -> ~str {
         cast::transmute(v)
@@ -1007,24 +831,6 @@ pub mod raw {
     /// Form a slice from a C string. Unsafe because the caller must ensure the
     /// C string has the static lifetime, or else the return value may be
     /// invalidated later.
-    #[cfg(stage0)]
-    pub unsafe fn c_str_to_static_slice(s: *libc::c_char) -> &'static str {
-        let s = s as *u8;
-        let mut curr = s;
-        let mut len = 0u;
-        while *curr != 0u8 {
-            len += 1u;
-            curr = ptr::offset(s, len as int);
-        }
-        let v = Slice { data: s, len: len + 1 };
-        assert!(is_utf8(cast::transmute(v)));
-        cast::transmute(v)
-    }
-
-    /// Form a slice from a C string. Unsafe because the caller must ensure the
-    /// C string has the static lifetime, or else the return value may be
-    /// invalidated later.
-    #[cfg(not(stage0))]
     pub unsafe fn c_str_to_static_slice(s: *libc::c_char) -> &'static str {
         let s = s as *u8;
         let mut curr = s;
@@ -1046,29 +852,6 @@ pub mod raw {
     ///
     /// If begin is greater than end.
     /// If end is greater than the length of the string.
-    #[cfg(stage0)]
-    #[inline]
-    pub unsafe fn slice_bytes<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
-        do s.as_imm_buf |sbuf, n| {
-             assert!((begin <= end));
-             assert!((end <= n));
-
-             cast::transmute(Slice {
-                 data: ptr::offset(sbuf, begin as int),
-                 len: end - begin + 1,
-             })
-        }
-    }
-
-    /// Takes a bytewise (not UTF-8) slice from a string.
-    ///
-    /// Returns the substring from [`begin`..`end`).
-    ///
-    /// # Failure
-    ///
-    /// If begin is greater than end.
-    /// If end is greater than the length of the string.
-    #[cfg(not(stage0))]
     #[inline]
     pub unsafe fn slice_bytes<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
         do s.as_imm_buf |sbuf, n| {
@@ -1083,18 +866,6 @@ pub mod raw {
     }
 
     /// Appends a byte to a string. (Not UTF-8 safe).
-    #[cfg(stage0)]
-    pub unsafe fn push_byte(s: &mut ~str, b: u8) {
-        let new_len = s.len() + 1;
-        s.reserve_at_least(new_len);
-        do s.as_mut_buf |buf, len| {
-            *ptr::mut_offset(buf, len as int) = b;
-        }
-        set_len(&mut *s, new_len);
-    }
-
-    /// Appends a byte to a string. (Not UTF-8 safe).
-    #[cfg(not(stage0))]
     #[inline]
     pub unsafe fn push_byte(s: &mut ~str, b: u8) {
         let v: &mut ~[u8] = cast::transmute(s);
@@ -1126,23 +897,11 @@ pub mod raw {
         return b;
     }
 
-    /// Sets the length of the string and adds the null terminator
-    #[cfg(stage0)]
-    #[inline]
-    pub unsafe fn set_len(v: &mut ~str, new_len: uint) {
-        let v: **mut String = cast::transmute(v);
-        let repr = *v;
-        (*repr).fill = new_len + 1u;
-        let null = ptr::mut_offset(&mut ((*repr).data), new_len as int);
-        *null = 0u8;
-    }
-
     /// Sets the length of a string
     ///
     /// This will explicitly set the size of the string, without actually
     /// modifing its buffers, so it is up to the caller to ensure that
     /// the string is actually the specified size.
-    #[cfg(not(stage0))]
     #[inline]
     pub unsafe fn set_len(s: &mut ~str, new_len: uint) {
         let v: &mut ~[u8] = cast::transmute(s);
@@ -1331,13 +1090,6 @@ impl<'self> Str for @str {
 }
 
 impl<'self> Container for &'self str {
-    #[cfg(stage0)]
-    #[inline]
-    fn len(&self) -> uint {
-        do self.as_imm_buf |_p, n| { n - 1u }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn len(&self) -> uint {
         do self.as_imm_buf |_p, n| { n }
@@ -1815,26 +1567,6 @@ impl<'self> StrSlice<'self> for &'self str {
     }
 
     /// Copy a slice into a new unique str
-    #[cfg(stage0)]
-    #[inline]
-    fn to_owned(&self) -> ~str {
-        do self.as_imm_buf |src, len| {
-            assert!(len > 0);
-            unsafe {
-                let mut v = vec::with_capacity(len);
-
-                do v.as_mut_buf |dst, _| {
-                    ptr::copy_memory(dst, src, len - 1);
-                }
-                vec::raw::set_len(&mut v, len - 1);
-                v.push(0u8);
-                ::cast::transmute(v)
-            }
-        }
-    }
-
-    /// Copy a slice into a new unique str
-    #[cfg(not(stage0))]
     #[inline]
     fn to_owned(&self) -> ~str {
         do self.as_imm_buf |src, len| {
@@ -1850,16 +1582,6 @@ impl<'self> StrSlice<'self> for &'self str {
         }
     }
 
-    #[cfg(stage0)]
-    #[inline]
-    fn to_managed(&self) -> @str {
-        let v = at_vec::from_fn(self.len() + 1, |i| {
-            if i == self.len() { 0 } else { self[i] }
-        });
-        unsafe { cast::transmute(v) }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn to_managed(&self) -> @str {
         unsafe {
@@ -2008,19 +1730,6 @@ impl<'self> StrSlice<'self> for &'self str {
     /// Work with the byte buffer of a string as a byte slice.
     ///
     /// The byte slice does not include the null terminator.
-    #[cfg(stage0)]
-    fn as_bytes(&self) -> &'self [u8] {
-        unsafe {
-            let mut slice = self.repr();
-            slice.len -= 1;
-            cast::transmute(slice)
-        }
-    }
-
-    /// Work with the byte buffer of a string as a byte slice.
-    ///
-    /// The byte slice does not include the null terminator.
-    #[cfg(not(stage0))]
     fn as_bytes(&self) -> &'self [u8] {
         unsafe { cast::transmute(*self) }
     }
@@ -2091,30 +1800,6 @@ impl<'self> StrSlice<'self> for &'self str {
     }
 
     /// Given a string, make a new string with repeated copies of it.
-    #[cfg(stage0)]
-    fn repeat(&self, nn: uint) -> ~str {
-        do self.as_imm_buf |buf, len| {
-            // ignore the NULL terminator
-            let len = len - 1;
-            let mut ret = with_capacity(nn * len);
-
-            unsafe {
-                do ret.as_mut_buf |rbuf, _len| {
-                    let mut rbuf = rbuf;
-
-                    do nn.times {
-                        ptr::copy_memory(rbuf, buf, len);
-                        rbuf = rbuf.offset(len as int);
-                    }
-                }
-                raw::set_len(&mut ret, nn * len);
-            }
-            ret
-        }
-    }
-
-    /// Given a string, make a new string with repeated copies of it.
-    #[cfg(not(stage0))]
     fn repeat(&self, nn: uint) -> ~str {
         do self.as_imm_buf |buf, len| {
             let mut ret = with_capacity(nn * len);
@@ -2250,8 +1935,6 @@ pub trait OwnedStr {
     fn reserve(&mut self, n: uint);
     fn reserve_at_least(&mut self, n: uint);
     fn capacity(&self) -> uint;
-    #[cfg(stage0)]
-    fn to_bytes_with_null(self) -> ~[u8];
 
     /// Work with the mutable byte buffer and length of a slice.
     ///
@@ -2397,30 +2080,6 @@ impl OwnedStr for ~str {
     ///
     /// * s - A string
     /// * n - The number of bytes to reserve space for
-    #[cfg(stage0)]
-    #[inline]
-    pub fn reserve(&mut self, n: uint) {
-        unsafe {
-            let v: *mut ~[u8] = cast::transmute(self);
-            (*v).reserve(n + 1);
-        }
-    }
-
-    /// Reserves capacity for exactly `n` bytes in the given string, not including
-    /// the null terminator.
-    ///
-    /// Assuming single-byte characters, the resulting string will be large
-    /// enough to hold a string of length `n`. To account for the null terminator,
-    /// the underlying buffer will have the size `n` + 1.
-    ///
-    /// If the capacity for `s` is already equal to or greater than the requested
-    /// capacity, then no action is taken.
-    ///
-    /// # Arguments
-    ///
-    /// * s - A string
-    /// * n - The number of bytes to reserve space for
-    #[cfg(not(stage0))]
     #[inline]
     pub fn reserve(&mut self, n: uint) {
         unsafe {
@@ -2429,30 +2088,6 @@ impl OwnedStr for ~str {
         }
     }
 
-    /// Reserves capacity for at least `n` bytes in the given string, not including
-    /// the null terminator.
-    ///
-    /// Assuming single-byte characters, the resulting string will be large
-    /// enough to hold a string of length `n`. To account for the null terminator,
-    /// the underlying buffer will have the size `n` + 1.
-    ///
-    /// This function will over-allocate in order to amortize the allocation costs
-    /// in scenarios where the caller may need to repeatedly reserve additional
-    /// space.
-    ///
-    /// If the capacity for `s` is already equal to or greater than the requested
-    /// capacity, then no action is taken.
-    ///
-    /// # Arguments
-    ///
-    /// * s - A string
-    /// * n - The number of bytes to reserve space for
-    #[cfg(stage0)]
-    #[inline]
-    fn reserve_at_least(&mut self, n: uint) {
-        self.reserve(uint::next_power_of_two(n + 1u) - 1u)
-    }
-
     /// Reserves capacity for at least `n` bytes in the given string.
     ///
     /// Assuming single-byte characters, the resulting string will be large
@@ -2470,7 +2105,6 @@ impl OwnedStr for ~str {
     ///
     /// * s - A string
     /// * n - The number of bytes to reserve space for
-    #[cfg(not(stage0))]
     #[inline]
     fn reserve_at_least(&mut self, n: uint) {
         self.reserve(uint::next_power_of_two(n))
@@ -2478,17 +2112,6 @@ impl OwnedStr for ~str {
 
     /// Returns the number of single-byte characters the string can hold without
     /// reallocating
-    #[cfg(stage0)]
-    fn capacity(&self) -> uint {
-        let buf: &~[u8] = unsafe { cast::transmute(self) };
-        let vcap = buf.capacity();
-        assert!(vcap > 0u);
-        vcap - 1u
-    }
-
-    /// Returns the number of single-byte characters the string can hold without
-    /// reallocating
-    #[cfg(not(stage0))]
     fn capacity(&self) -> uint {
         unsafe {
             let buf: &~[u8] = cast::transmute(self);
@@ -2496,14 +2119,6 @@ impl OwnedStr for ~str {
         }
     }
 
-    /// Convert to a vector of bytes. This does not allocate a new
-    /// string, and includes the null terminator.
-    #[cfg(stage0)]
-    #[inline]
-    fn to_bytes_with_null(self) -> ~[u8] {
-        unsafe { cast::transmute(self) }
-    }
-
     #[inline]
     fn as_mut_buf<T>(&mut self, f: &fn(*mut u8, uint) -> T) -> T {
         let v: &mut ~[u8] = unsafe { cast::transmute(self) };
@@ -3208,45 +2823,6 @@ mod tests {
         assert_eq!("ศไทย中华Việt Nam".as_bytes(), v);
     }
 
-    #[cfg(stage0)]
-    #[test]
-    #[ignore(cfg(windows))]
-    #[should_fail]
-    fn test_as_bytes_fail() {
-        // Don't double free. (I'm not sure if this exercises the
-        // original problem code path anymore.)
-        let s = ~"";
-        let _bytes = s.as_bytes();
-        fail!();
-    }
-
-    #[cfg(stage0)]
-    #[test]
-    #[ignore(cfg(windows))]
-    #[should_fail]
-    fn test_as_bytes_fail() {
-        // Don't double free. (I'm not sure if this exercises the
-        // original problem code path anymore.)
-        let s = ~"";
-        let _bytes = s.as_bytes_with_null();
-        fail!();
-    }
-
-    #[cfg(stage0)]
-    #[test]
-    fn test_to_bytes_with_null() {
-        let s = ~"ศไทย中华Việt Nam";
-        let v = ~[
-            224, 184, 168, 224, 185, 132, 224, 184, 151, 224, 184, 162, 228,
-            184, 173, 229, 141, 142, 86, 105, 225, 187, 135, 116, 32, 78, 97,
-            109, 0
-        ];
-        assert_eq!((~"").to_bytes_with_null(), ~[0]);
-        assert_eq!((~"abc").to_bytes_with_null(),
-                   ~['a' as u8, 'b' as u8, 'c' as u8, 0]);
-        assert_eq!(s.to_bytes_with_null(), v);
-    }
-
     #[test]
     #[ignore(cfg(windows))]
     #[should_fail]
diff --git a/src/libstd/str/ascii.rs b/src/libstd/str/ascii.rs
index c6ae535c19a..701d5738815 100644
--- a/src/libstd/str/ascii.rs
+++ b/src/libstd/str/ascii.rs
@@ -19,8 +19,6 @@ use cast;
 use ptr;
 use iterator::Iterator;
 use vec::{CopyableVector, ImmutableVector};
-#[cfg(stage0)]
-use vec::OwnedVector;
 use to_bytes::IterBytes;
 use option::{Some, None};
 
@@ -105,14 +103,6 @@ impl<'self> AsciiCast<&'self [Ascii]> for &'self str {
         unsafe { self.to_ascii_nocheck() }
     }
 
-    #[cfg(stage0)]
-    #[inline]
-    unsafe fn to_ascii_nocheck(&self) -> &'self [Ascii] {
-        let (p,len): (*u8, uint) = cast::transmute(*self);
-        cast::transmute((p, len - 1))
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     unsafe fn to_ascii_nocheck(&self) -> &'self [Ascii] {
         cast::transmute(*self)
@@ -190,15 +180,6 @@ impl OwnedAsciiCast for ~str {
         unsafe {self.into_ascii_nocheck()}
     }
 
-    #[cfg(stage0)]
-    #[inline]
-    unsafe fn into_ascii_nocheck(self) -> ~[Ascii] {
-        let mut r: ~[Ascii] = cast::transmute(self);
-        r.pop();
-        r
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     unsafe fn into_ascii_nocheck(self) -> ~[Ascii] {
         cast::transmute(self)
@@ -221,15 +202,6 @@ pub trait AsciiStr {
 }
 
 impl<'self> AsciiStr for &'self [Ascii] {
-    #[cfg(stage0)]
-    #[inline]
-    fn to_str_ascii(&self) -> ~str {
-        let mut cpy = self.to_owned();
-        cpy.push(0u8.to_ascii());
-        unsafe { cast::transmute(cpy) }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn to_str_ascii(&self) -> ~str {
         let cpy = self.to_owned();
@@ -253,15 +225,6 @@ impl<'self> AsciiStr for &'self [Ascii] {
 }
 
 impl ToStrConsume for ~[Ascii] {
-    #[cfg(stage0)]
-    #[inline]
-    fn into_str(self) -> ~str {
-        let mut cpy = self;
-        cpy.push(0u8.to_ascii());
-        unsafe { cast::transmute(cpy) }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn into_str(self) -> ~str {
         unsafe { cast::transmute(self) }
diff --git a/src/libstd/unstable/intrinsics.rs b/src/libstd/unstable/intrinsics.rs
index 92725fda705..861b4f9a350 100644
--- a/src/libstd/unstable/intrinsics.rs
+++ b/src/libstd/unstable/intrinsics.rs
@@ -328,10 +328,6 @@ extern "rust-intrinsic" {
     /// Returns `true` if a type is managed (will be allocated on the local heap)
     pub fn contains_managed<T>() -> bool;
 
-    #[cfg(stage0)]
-    pub fn visit_tydesc(td: *TyDesc, tv: @TyVisitor);
-
-    #[cfg(not(stage0))]
     pub fn visit_tydesc(td: *TyDesc, tv: &TyVisitor);
 
     pub fn frame_address(f: &once fn(*u8));
@@ -351,7 +347,6 @@ extern "rust-intrinsic" {
     ///
     /// This intrinsic should be preferred over `offset` when the guarantee can
     /// be satisfied, to enable better optimization.
-    #[cfg(not(stage0))]
     pub fn offset_inbounds<T>(dst: *T, offset: int) -> *T;
 
     /// Equivalent to the `llvm.memcpy.p0i8.0i8.i32` intrinsic, with a size of
@@ -451,58 +446,34 @@ extern "rust-intrinsic" {
     pub fn bswap32(x: i32) -> i32;
     pub fn bswap64(x: i64) -> i64;
 
-    #[cfg(not(stage0))]
     pub fn i8_add_with_overflow(x: i8, y: i8) -> (i8, bool);
-    #[cfg(not(stage0))]
     pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
-    #[cfg(not(stage0))]
     pub fn i32_add_with_overflow(x: i32, y: i32) -> (i32, bool);
-    #[cfg(not(stage0))]
     pub fn i64_add_with_overflow(x: i64, y: i64) -> (i64, bool);
 
-    #[cfg(not(stage0))]
     pub fn u8_add_with_overflow(x: u8, y: u8) -> (u8, bool);
-    #[cfg(not(stage0))]
     pub fn u16_add_with_overflow(x: u16, y: u16) -> (u16, bool);
-    #[cfg(not(stage0))]
     pub fn u32_add_with_overflow(x: u32, y: u32) -> (u32, bool);
-    #[cfg(not(stage0))]
     pub fn u64_add_with_overflow(x: u64, y: u64) -> (u64, bool);
 
-    #[cfg(not(stage0))]
     pub fn i8_sub_with_overflow(x: i8, y: i8) -> (i8, bool);
-    #[cfg(not(stage0))]
     pub fn i16_sub_with_overflow(x: i16, y: i16) -> (i16, bool);
-    #[cfg(not(stage0))]
     pub fn i32_sub_with_overflow(x: i32, y: i32) -> (i32, bool);
-    #[cfg(not(stage0))]
     pub fn i64_sub_with_overflow(x: i64, y: i64) -> (i64, bool);
 
-    #[cfg(not(stage0))]
     pub fn u8_sub_with_overflow(x: u8, y: u8) -> (u8, bool);
-    #[cfg(not(stage0))]
     pub fn u16_sub_with_overflow(x: u16, y: u16) -> (u16, bool);
-    #[cfg(not(stage0))]
     pub fn u32_sub_with_overflow(x: u32, y: u32) -> (u32, bool);
-    #[cfg(not(stage0))]
     pub fn u64_sub_with_overflow(x: u64, y: u64) -> (u64, bool);
 
-    #[cfg(not(stage0))]
     pub fn i8_mul_with_overflow(x: i8, y: i8) -> (i8, bool);
-    #[cfg(not(stage0))]
     pub fn i16_mul_with_overflow(x: i16, y: i16) -> (i16, bool);
-    #[cfg(not(stage0))]
     pub fn i32_mul_with_overflow(x: i32, y: i32) -> (i32, bool);
-    #[cfg(not(stage0))]
     pub fn i64_mul_with_overflow(x: i64, y: i64) -> (i64, bool);
 
-    #[cfg(not(stage0))]
     pub fn u8_mul_with_overflow(x: u8, y: u8) -> (u8, bool);
-    #[cfg(not(stage0))]
     pub fn u16_mul_with_overflow(x: u16, y: u16) -> (u16, bool);
-    #[cfg(not(stage0))]
     pub fn u32_mul_with_overflow(x: u32, y: u32) -> (u32, bool);
-    #[cfg(not(stage0))]
     pub fn u64_mul_with_overflow(x: u64, y: u64) -> (u64, bool);
 }