auto merge of #16886 : Tobba/rust/defailbloat-string, r=alexcrichton
by not performing formatting at the failure site This cuts about 673382 bytes from libcore.rlib
This commit is contained in:
commit
eb7589a188
2 changed files with 9 additions and 3 deletions
|
@ -55,6 +55,11 @@ fn fail_bounds_check(file_line: &(&'static str, uint),
|
||||||
unsafe { intrinsics::abort() }
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
#[cold] #[inline(never)]
|
#[cold] #[inline(never)]
|
||||||
pub fn begin_unwind(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
|
pub fn begin_unwind(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
|
||||||
#[allow(ctypes)]
|
#[allow(ctypes)]
|
||||||
|
|
|
@ -16,9 +16,10 @@ macro_rules! fail(
|
||||||
() => (
|
() => (
|
||||||
fail!("{}", "explicit failure")
|
fail!("{}", "explicit failure")
|
||||||
);
|
);
|
||||||
($msg:expr) => (
|
($msg:expr) => ({
|
||||||
fail!("{}", $msg)
|
static _FILE_LINE: (&'static str, uint) = (file!(), line!());
|
||||||
);
|
::core::failure::begin_unwind_string($msg, &_FILE_LINE)
|
||||||
|
});
|
||||||
($fmt:expr, $($arg:tt)*) => ({
|
($fmt:expr, $($arg:tt)*) => ({
|
||||||
// a closure can't have return type !, so we need a full
|
// a closure can't have return type !, so we need a full
|
||||||
// function to pass to format_args!, *and* we need the
|
// function to pass to format_args!, *and* we need the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue