@@ -384,7 +384,7 @@ pub mod eabi {
384384#[ lang = "begin_unwind" ]
385385pub extern fn rust_begin_unwind ( msg : & fmt:: Arguments ,
386386 file : & ' static str , line : uint ) -> ! {
387- begin_unwind_fmt ( msg, file, line)
387+ begin_unwind_fmt ( msg, & ( file, line) )
388388}
389389
390390/// The entry point for unwinding with a formatted message.
@@ -394,8 +394,7 @@ pub extern fn rust_begin_unwind(msg: &fmt::Arguments,
394394/// on (e.g.) the inlining of other functions as possible), by moving
395395/// the actual formatting into this shared place.
396396#[ inline( never) ] #[ cold]
397- pub fn begin_unwind_fmt ( msg : & fmt:: Arguments , file : & ' static str ,
398- line : uint ) -> ! {
397+ pub fn begin_unwind_fmt ( msg : & fmt:: Arguments , file_line : & ( & ' static str , uint ) ) -> ! {
399398 use core:: fmt:: FormatWriter ;
400399
401400 // We do two allocations here, unfortunately. But (a) they're
@@ -415,9 +414,10 @@ pub fn begin_unwind_fmt(msg: &fmt::Arguments, file: &'static str,
415414 let mut v = Vec :: new ( ) ;
416415 let _ = write ! ( & mut VecWriter { v: & mut v } , "{}" , msg) ;
417416
418- begin_unwind_inner ( box String :: from_utf8 ( v) . unwrap ( ) , file , line )
417+ begin_unwind_inner ( box String :: from_utf8 ( v) . unwrap ( ) , file_line )
419418}
420419
420+ // FIXME: Need to change expr_fail in AstBuilder to change this to &(str, uint)
421421/// This is the entry point of unwinding for fail!() and assert!().
422422#[ inline( never) ] #[ cold] // avoid code bloat at the call sites as much as possible
423423pub fn begin_unwind < M : Any + Send > ( msg : M , file : & ' static str , line : uint ) -> ! {
@@ -429,13 +429,7 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> !
429429 // failing.
430430
431431 // see below for why we do the `Any` coercion here.
432- begin_unwind_inner ( box msg, file, line)
433- }
434-
435- /// Unwinding for `fail!()`. Saves passing a string.
436- #[ inline( never) ] #[ cold] #[ experimental]
437- pub fn begin_unwind_no_time_to_explain ( file : & ' static str , line : uint ) -> ! {
438- begin_unwind_inner ( box ( ) ( "explicit failure" ) , file, line)
432+ begin_unwind_inner ( box msg, & ( file, line) )
439433}
440434
441435/// The core of the unwinding.
@@ -448,9 +442,7 @@ pub fn begin_unwind_no_time_to_explain(file: &'static str, line: uint) -> ! {
448442/// Do this split took the LLVM IR line counts of `fn main() { fail!()
449443/// }` from ~1900/3700 (-O/no opts) to 180/590.
450444#[ inline( never) ] #[ cold] // this is the slow path, please never inline this
451- fn begin_unwind_inner ( msg : Box < Any + Send > ,
452- file : & ' static str ,
453- line : uint ) -> ! {
445+ fn begin_unwind_inner ( msg : Box < Any + Send > , file_line : & ( & ' static str , uint ) ) -> ! {
454446 // First, invoke call the user-defined callbacks triggered on task failure.
455447 //
456448 // By the time that we see a callback has been registered (by reading
@@ -467,6 +459,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>,
467459 0 => { }
468460 n => {
469461 let f: Callback = unsafe { mem:: transmute ( n) } ;
462+ let ( file, line) = * file_line;
470463 f ( msg, file, line) ;
471464 }
472465 }
0 commit comments