Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustrt/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern crate collections;
#[cfg(test)] #[phase(plugin, link)] extern crate std;

pub use self::util::{Stdio, Stdout, Stderr};
pub use self::unwind::{begin_unwind, begin_unwind_fmt};
pub use self::unwind::{begin_unwind, begin_unwind_fmt, begin_unwind_no_time_to_explain};

use core::prelude::*;

Expand Down
5 changes: 5 additions & 0 deletions src/librustrt/unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> !
begin_unwind_inner(box msg, file, line)
}

/// Unwinding for `fail!()`. Saves passing a string.
#[inline(never)] #[cold] #[experimental]
pub fn begin_unwind_no_time_to_explain(file: &'static str, line: uint) -> ! {
begin_unwind_inner(box () ("explicit failure"), file, line)
}

/// The core of the unwinding.
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#[macro_export]
macro_rules! fail(
() => (
fail!("explicit failure")
::std::rt::begin_unwind_no_time_to_explain(file!(), line!())
);
($msg:expr) => (
::std::rt::begin_unwind($msg, file!(), line!())
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ pub use self::util::{default_sched_threads, min_stack, running_on_valgrind};
// standard library which work together to create the entire runtime.
pub use alloc::{heap, libc_heap};
pub use rustrt::{task, local, mutex, exclusive, stack, args, rtio, thread};
pub use rustrt::{Stdio, Stdout, Stderr, begin_unwind, begin_unwind_fmt};
pub use rustrt::{Stdio, Stdout, Stderr};
pub use rustrt::{begin_unwind, begin_unwind_fmt, begin_unwind_no_time_to_explain};
pub use rustrt::{bookkeeping, at_exit, unwind, DEFAULT_ERROR_CODE, Runtime};

// Simple backtrace functionality (to print on failure)
Expand Down