diff options
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/macros.rs | 18 | ||||
| -rw-r--r-- | src/libstd/rt/unwind.rs | 47 | ||||
| -rw-r--r-- | src/libstd/rt/util.rs | 16 |
3 files changed, 1 insertions, 80 deletions
diff --git a/src/libstd/rt/macros.rs b/src/libstd/rt/macros.rs index 095a27203f9..0f35500a04a 100644 --- a/src/libstd/rt/macros.rs +++ b/src/libstd/rt/macros.rs @@ -15,22 +15,12 @@ #![macro_escape] -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] macro_rules! rterrln { ($fmt:expr $($arg:tt)*) => ( { ::rt::util::dumb_print(format_args!(concat!($fmt, "\n") $($arg)*)) } ) } -// NOTE(stage0): Remove macro after a snapshot -#[cfg(stage0)] -macro_rules! rterrln { - ($fmt:expr $($arg:tt)*) => ( { - format_args!(::rt::util::dumb_print, concat!($fmt, "\n") $($arg)*) - } ) -} - // Some basic logging. Enabled by passing `--cfg rtdebug` to the libstd build. macro_rules! rtdebug { ($($arg:tt)*) => ( { @@ -50,14 +40,6 @@ macro_rules! rtassert { } ) } -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] macro_rules! rtabort { ($($arg:tt)*) => (::rt::util::abort(format_args!($($arg)*))) } - -// NOTE(stage0): Remove macro after a snapshot -#[cfg(stage0)] -macro_rules! rtabort { - ($($arg:tt)*) => (format_args!(::rt::util::abort, $($arg)*)) -} diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index 9b57dcc9e18..c273c52dacc 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -477,8 +477,6 @@ pub mod eabi { } } -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] #[cfg(not(test))] /// Entry point of panic from the libcore crate. #[lang = "panic_fmt"] @@ -487,18 +485,6 @@ pub extern fn rust_begin_unwind(msg: fmt::Arguments, begin_unwind_fmt(msg, &(file, line)) } -// NOTE(stage0): Remove function after a snapshot -#[cfg(stage0)] -#[cfg(not(test))] -/// Entry point of panic from the libcore crate. -#[lang = "panic_fmt"] -pub extern fn rust_begin_unwind(msg: &fmt::Arguments, - file: &'static str, line: uint) -> ! { - begin_unwind_fmt(msg, &(file, line)) -} - -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] /// The entry point for unwinding with a formatted message. /// /// This is designed to reduce the amount of code required at the call @@ -530,39 +516,6 @@ pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, uint)) - begin_unwind_inner(msg, file_line) } -// NOTE(stage0): Remove function after a snapshot -#[cfg(stage0)] -/// The entry point for unwinding with a formatted message. -/// -/// This is designed to reduce the amount of code required at the call -/// site as much as possible (so that `panic!()` has as low an impact -/// on (e.g.) the inlining of other functions as possible), by moving -/// the actual formatting into this shared place. -#[inline(never)] #[cold] -pub fn begin_unwind_fmt(msg: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! { - use fmt::FormatWriter; - - // We do two allocations here, unfortunately. But (a) they're - // required with the current scheme, and (b) we don't handle - // panic + OOM properly anyway (see comment in begin_unwind - // below). - - struct VecWriter<'a> { v: &'a mut Vec<u8> } - - impl<'a> fmt::FormatWriter for VecWriter<'a> { - fn write(&mut self, buf: &[u8]) -> fmt::Result { - self.v.push_all(buf); - Ok(()) - } - } - - let mut v = Vec::new(); - let _ = write!(&mut VecWriter { v: &mut v }, "{}", msg); - - let msg = box String::from_utf8_lossy(v.as_slice()).into_owned(); - begin_unwind_inner(msg, file_line) -} - /// This is the entry point of unwinding for panic!() and assert!(). #[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) -> ! { diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 6b007056a51..5448af3f753 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -112,25 +112,11 @@ impl fmt::FormatWriter for Stdio { } } -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] pub fn dumb_print(args: fmt::Arguments) { let _ = Stderr.write_fmt(args); } -// NOTE(stage0): Remove function after a snapshot -#[cfg(stage0)] -pub fn dumb_print(args: &fmt::Arguments) { - let mut w = Stderr; - let _ = write!(&mut w, "{}", args); -} - -// NOTE(stage0): Remove wrappers after a snapshot -#[cfg(not(stage0))] pub fn abort(args: fmt::Arguments) -> ! { abort_(&args) } -#[cfg(stage0)] pub fn abort(args: &fmt::Arguments) -> ! { abort_(args) } - -// NOTE(stage0): Change to `pub fn abort(args: fmt::Arguments) -> !` after a snapshot -fn abort_(args: &fmt::Arguments) -> ! { +pub fn abort(args: fmt::Arguments) -> ! { use fmt::FormatWriter; struct BufWriter<'a> { |
