about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2014-11-01 19:51:16 +0200
committerEduard Burtescu <edy.burt@gmail.com>2014-11-05 12:55:58 +0200
commit56dbf3d1223bca9e02a201e43fb48895a1d5cbd1 (patch)
treedba9141d0aad42d415126320f7e9d8fdeece6841 /src/libcore
parenteca8f11315cb3cd9836e6d8501a07fbb137f5e88 (diff)
downloadrust-56dbf3d1223bca9e02a201e43fb48895a1d5cbd1.tar.gz
rust-56dbf3d1223bca9e02a201e43fb48895a1d5cbd1.zip
Register snapshots.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/fmt/mod.rs153
-rw-r--r--src/libcore/intrinsics.rs1
-rw-r--r--src/libcore/ops.rs12
-rw-r--r--src/libcore/panicking.rs47
4 files changed, 4 insertions, 209 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index ddfbfa78502..013ed999b03 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -250,37 +250,6 @@ pub trait UpperExp for Sized? {
     fn fmt(&self, &mut Formatter) -> Result;
 }
 
-// NOTE(stage0): Remove macro after next snapshot
-#[cfg(stage0)]
-macro_rules! uniform_fn_call_workaround {
-    ($( $name: ident, $trait_: ident; )*) => {
-        $(
-            #[doc(hidden)]
-            pub fn $name<Sized? T: $trait_>(x: &T, fmt: &mut Formatter) -> Result {
-                x.fmt(fmt)
-            }
-            )*
-    }
-}
-// NOTE(stage0): Remove macro after next snapshot
-#[cfg(stage0)]
-uniform_fn_call_workaround! {
-    secret_show, Show;
-    secret_bool, Bool;
-    secret_char, Char;
-    secret_signed, Signed;
-    secret_unsigned, Unsigned;
-    secret_octal, Octal;
-    secret_binary, Binary;
-    secret_lower_hex, LowerHex;
-    secret_upper_hex, UpperHex;
-    secret_string, String;
-    secret_pointer, Pointer;
-    secret_float, Float;
-    secret_lower_exp, LowerExp;
-    secret_upper_exp, UpperExp;
-}
-
 static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument {
     position: rt::ArgumentNext,
     format: rt::FormatSpec {
@@ -570,16 +539,6 @@ pub fn argument<'a, T>(f: extern "Rust" fn(&T, &mut Formatter) -> Result,
 
 /// When the compiler determines that the type of an argument *must* be a string
 /// (such as for select), then it invokes this method.
-// NOTE(stage0): remove function after a snapshot
-#[cfg(stage0)]
-#[doc(hidden)] #[inline]
-pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
-    argument(secret_string, s)
-}
-
-/// When the compiler determines that the type of an argument *must* be a string
-/// (such as for select), then it invokes this method.
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 #[doc(hidden)] #[inline]
 pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
     argument(String::fmt, s)
@@ -587,16 +546,6 @@ pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
 
 /// When the compiler determines that the type of an argument *must* be a uint
 /// (such as for plural), then it invokes this method.
-// NOTE(stage0): remove function after a snapshot
-#[cfg(stage0)]
-#[doc(hidden)] #[inline]
-pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
-    argument(secret_unsigned, s)
-}
-
-/// When the compiler determines that the type of an argument *must* be a uint
-/// (such as for plural), then it invokes this method.
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 #[doc(hidden)] #[inline]
 pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
     argument(Unsigned::fmt, s)
@@ -614,15 +563,6 @@ impl<'a> Show for &'a Show+'a {
     fn fmt(&self, f: &mut Formatter) -> Result { (*self).fmt(f) }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl Bool for bool {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_string(&(if *self {"true"} else {"false"}), f)
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl Bool for bool {
     fn fmt(&self, f: &mut Formatter) -> Result {
         String::fmt(if *self { "true" } else { "false" }, f)
@@ -641,20 +581,6 @@ impl String for str {
     }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl Char for char {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        use char::Char;
-
-        let mut utf8 = [0u8, ..4];
-        let amt = self.encode_utf8(utf8).unwrap_or(0);
-        let s: &str = unsafe { mem::transmute(utf8[..amt]) };
-        secret_string(&s, f)
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl Char for char {
     fn fmt(&self, f: &mut Formatter) -> Result {
         use char::Char;
@@ -666,16 +592,6 @@ impl Char for char {
     }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<T> Pointer for *const T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        f.flags |= 1 << (rt::FlagAlternate as uint);
-        secret_lower_hex::<uint>(&(*self as uint), f)
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl<T> Pointer for *const T {
     fn fmt(&self, f: &mut Formatter) -> Result {
         f.flags |= 1 << (rt::FlagAlternate as uint);
@@ -683,45 +599,18 @@ impl<T> Pointer for *const T {
     }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<T> Pointer for *mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_pointer::<*const T>(&(*self as *const T), f)
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl<T> Pointer for *mut T {
     fn fmt(&self, f: &mut Formatter) -> Result {
         Pointer::fmt(&(*self as *const T), f)
     }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<'a, T> Pointer for &'a T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_pointer::<*const T>(&(&**self as *const T), f)
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl<'a, T> Pointer for &'a T {
     fn fmt(&self, f: &mut Formatter) -> Result {
         Pointer::fmt(&(*self as *const T), f)
     }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<'a, T> Pointer for &'a mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_pointer::<*const T>(&(&**self as *const T), f)
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl<'a, T> Pointer for &'a mut T {
     fn fmt(&self, f: &mut Formatter) -> Result {
         Pointer::fmt(&(&**self as *const T), f)
@@ -797,29 +686,6 @@ floating!(f64)
 
 // Implementation of Show for various core types
 
-// NOTE(stage0): remove macro after a snapshot
-#[cfg(stage0)]
-macro_rules! delegate(($ty:ty to $other:ident) => {
-    impl Show for $ty {
-        fn fmt(&self, f: &mut Formatter) -> Result {
-            (concat_idents!(secret_, $other)(self, f))
-        }
-    }
-})
-
-// NOTE(stage0): remove these macros after a snapshot
-#[cfg(stage0)]
-delegate!(str to string)
-#[cfg(stage0)]
-delegate!(bool to bool)
-#[cfg(stage0)]
-delegate!(char to char)
-#[cfg(stage0)]
-delegate!(f32 to float)
-#[cfg(stage0)]
-delegate!(f64 to float)
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 macro_rules! delegate(($ty:ty to $other:ident) => {
     impl Show for $ty {
         fn fmt(&self, f: &mut Formatter) -> Result {
@@ -827,35 +693,16 @@ macro_rules! delegate(($ty:ty to $other:ident) => {
         }
     }
 })
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 delegate!(str to String)
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 delegate!(bool to Bool)
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 delegate!(char to Char)
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 delegate!(f32 to Float)
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 delegate!(f64 to Float)
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<T> Show for *const T {
-    fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl<T> Show for *const T {
     fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<T> Show for *mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
 impl<T> Show for *mut T {
     fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
 }
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 9d5c2113cb2..91f95ef203c 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -171,7 +171,6 @@ extern "rust-intrinsic" {
     /// with optimization of surrounding code and reduce performance. It should
     /// not be used if the invariant can be discovered by the optimizer on its
     /// own, or if it does not enable any significant optimizations.
-    #[cfg(not(stage0))]
     pub fn assume(b: bool);
 
     /// Execute a breakpoint trap, for inspection by a debugger.
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index f6e3e7f61cf..8d072fffb60 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -849,24 +849,21 @@ pub trait DerefMut<Sized? Result>: Deref<Result> {
 #[lang="fn"]
 pub trait Fn<Args,Result> {
     /// This is called when the call operator is used.
-    #[rust_call_abi_hack]
-    fn call(&self, args: Args) -> Result;
+    extern "rust-call" fn call(&self, args: Args) -> Result;
 }
 
 /// A version of the call operator that takes a mutable receiver.
 #[lang="fn_mut"]
 pub trait FnMut<Args,Result> {
     /// This is called when the call operator is used.
-    #[rust_call_abi_hack]
-    fn call_mut(&mut self, args: Args) -> Result;
+    extern "rust-call" fn call_mut(&mut self, args: Args) -> Result;
 }
 
 /// A version of the call operator that takes a by-value receiver.
 #[lang="fn_once"]
 pub trait FnOnce<Args,Result> {
     /// This is called when the call operator is used.
-    #[rust_call_abi_hack]
-    fn call_once(self, args: Args) -> Result;
+    extern "rust-call" fn call_once(self, args: Args) -> Result;
 }
 
 macro_rules! def_fn_mut(
@@ -874,9 +871,8 @@ macro_rules! def_fn_mut(
         impl<Result$(,$args)*>
         FnMut<($($args,)*),Result>
         for extern "Rust" fn($($args: $args,)*) -> Result {
-            #[rust_call_abi_hack]
             #[allow(non_snake_case)]
-            fn call_mut(&mut self, args: ($($args,)*)) -> Result {
+            extern "rust-call" fn call_mut(&mut self, args: ($($args,)*)) -> Result {
                 let ($($args,)*) = args;
                 (*self)($($args,)*)
             }
diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs
index 39de04c27ce..fd0526db411 100644
--- a/src/libcore/panicking.rs
+++ b/src/libcore/panicking.rs
@@ -33,49 +33,6 @@
 use fmt;
 use intrinsics;
 
-// NOTE(stage0): remove after a snapshot
-#[cfg(stage0)]
-#[cold] #[inline(never)] // this is the slow path, always
-#[lang="fail"]
-pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
-    let (expr, file, line) = *expr_file_line;
-    let ref file_line = (file, line);
-    format_args!(|args| -> () {
-        panic_fmt(args, file_line);
-    }, "{}", expr);
-
-    unsafe { intrinsics::abort() }
-}
-
-// NOTE(stage0): remove after a snapshot
-#[cfg(stage0)]
-#[cold] #[inline(never)]
-#[lang="fail_bounds_check"]
-fn panic_bounds_check(file_line: &(&'static str, uint),
-                     index: uint, len: uint) -> ! {
-    format_args!(|args| -> () {
-        panic_fmt(args, file_line);
-    }, "index out of bounds: the len is {} but the index is {}", len, index);
-    unsafe { intrinsics::abort() }
-}
-
-// NOTE(stage0): remove after a snapshot
-#[cfg(stage0)]
-#[cold] #[inline(never)]
-pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
-    #[allow(improper_ctypes)]
-    extern {
-        #[lang = "fail_fmt"]
-        fn panic_impl(fmt: &fmt::Arguments, file: &'static str,
-                        line: uint) -> !;
-
-    }
-    let (file, line) = *file_line;
-    unsafe { panic_impl(fmt, file, line) }
-}
-
-// NOTE(stage0): remove cfg after a snapshot
-#[cfg(not(stage0))]
 #[cold] #[inline(never)] // this is the slow path, always
 #[lang="panic"]
 pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
@@ -88,8 +45,6 @@ pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
     unsafe { intrinsics::abort() }
 }
 
-// NOTE(stage0): remove cfg after a snapshot
-#[cfg(not(stage0))]
 #[cold] #[inline(never)]
 #[lang="panic_bounds_check"]
 fn panic_bounds_check(file_line: &(&'static str, uint),
@@ -100,8 +55,6 @@ fn panic_bounds_check(file_line: &(&'static str, uint),
     unsafe { intrinsics::abort() }
 }
 
-// NOTE(stage0): remove cfg after a snapshot
-#[cfg(not(stage0))]
 #[cold] #[inline(never)]
 pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
     #[allow(improper_ctypes)]