Rename core::failure::begin_unwind to fail_impl, refs #16114

This commit is contained in:
Florian Hahn 2014-09-21 23:25:24 +02:00
parent 9a01da9460
commit 45f4081e61
2 changed files with 11 additions and 11 deletions

View File

@ -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
@ -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() }
@ -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) }
}

View File

@ -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
@ -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)*)
});