Skip to content

Commit

Permalink
Rename core::failure::begin_unwind to fail_impl, refs #16114
Browse files Browse the repository at this point in the history
  • Loading branch information
fhahn committed Sep 24, 2014
1 parent 9a01da9 commit 45f4081
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/libcore/failure.rs
Expand Up @@ -16,7 +16,7 @@
//! interface for failure is:
//!
//! ```ignore
//! fn begin_unwind(fmt: &fmt::Arguments, &(&'static str, uint)) -> !;
//! fn fail_impl(fmt: &fmt::Arguments, &(&'static str, uint)) -> !;
//! ```
//!
//! This definition allows for failing with any general message, but it does not
Expand All @@ -39,7 +39,7 @@ fn fail_(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
let (expr, file, line) = *expr_file_line;
let ref file_line = (file, line);
format_args!(|args| -> () {
begin_unwind(args, file_line);
fail_impl(args, file_line);
}, "{}", expr);

unsafe { intrinsics::abort() }
Expand All @@ -50,33 +50,33 @@ fn fail_(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
fn fail_bounds_check(file_line: &(&'static str, uint),
index: uint, len: uint) -> ! {
format_args!(|args| -> () {
begin_unwind(args, file_line);
fail_impl(args, file_line);
}, "index out of bounds: the len is {} but the index is {}", len, index);
unsafe { intrinsics::abort() }
}

#[cold] #[inline(never)]
pub fn begin_unwind_string(msg: &str, file: &(&'static str, uint)) -> ! {
format_args!(|fmt| begin_unwind(fmt, file), "{}", msg)
pub fn fail_impl_string(msg: &str, file: &(&'static str, uint)) -> ! {
format_args!(|fmt| fail_impl(fmt, file), "{}", msg)
}

#[cold] #[inline(never)]
pub fn begin_unwind(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
pub fn fail_impl(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
#[allow(ctypes)]
extern {

#[cfg(stage0)]
#[lang = "begin_unwind"]
fn begin_unwind(fmt: &fmt::Arguments, file: &'static str,
fn fail_impl(fmt: &fmt::Arguments, file: &'static str,
line: uint) -> !;

#[cfg(not(stage0))]
#[lang = "fail_fmt"]
fn begin_unwind(fmt: &fmt::Arguments, file: &'static str,
fn fail_impl(fmt: &fmt::Arguments, file: &'static str,
line: uint) -> !;

}
let (file, line) = *file_line;
unsafe { begin_unwind(fmt, file, line) }
unsafe { fail_impl(fmt, file, line) }
}

4 changes: 2 additions & 2 deletions src/libcore/macros.rs
Expand Up @@ -18,7 +18,7 @@ macro_rules! fail(
);
($msg:expr) => ({
static _FILE_LINE: (&'static str, uint) = (file!(), line!());
::core::failure::begin_unwind_string($msg, &_FILE_LINE)
::core::failure::fail_impl_string($msg, &_FILE_LINE)
});
($fmt:expr, $($arg:tt)*) => ({
// a closure can't have return type !, so we need a full
Expand All @@ -40,7 +40,7 @@ macro_rules! fail(
#[inline(always)]
fn _run_fmt(fmt: &::std::fmt::Arguments) -> ! {
static _FILE_LINE: (&'static str, uint) = (file!(), line!());
::core::failure::begin_unwind(fmt, &_FILE_LINE)
::core::failure::fail_impl(fmt, &_FILE_LINE)
}
format_args!(_run_fmt, $fmt, $($arg)*)
});
Expand Down

0 comments on commit 45f4081

Please sign in to comment.