@@ -384,7 +384,7 @@ pub mod eabi {
384
384
#[ lang = "begin_unwind" ]
385
385
pub extern fn rust_begin_unwind ( msg : & fmt:: Arguments ,
386
386
file : & ' static str , line : uint ) -> ! {
387
- begin_unwind_fmt ( msg, file, line)
387
+ begin_unwind_fmt ( msg, & ( file, line) )
388
388
}
389
389
390
390
/// The entry point for unwinding with a formatted message.
@@ -394,8 +394,7 @@ pub extern fn rust_begin_unwind(msg: &fmt::Arguments,
394
394
/// on (e.g.) the inlining of other functions as possible), by moving
395
395
/// the actual formatting into this shared place.
396
396
#[ 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 ) ) -> ! {
399
398
use core:: fmt:: FormatWriter ;
400
399
401
400
// 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,
415
414
let mut v = Vec :: new ( ) ;
416
415
let _ = write ! ( & mut VecWriter { v: & mut v } , "{}" , msg) ;
417
416
418
- begin_unwind_inner ( box String :: from_utf8 ( v) . unwrap ( ) , file , line )
417
+ begin_unwind_inner ( box String :: from_utf8 ( v) . unwrap ( ) , file_line )
419
418
}
420
419
420
+ // FIXME: Need to change expr_fail in AstBuilder to change this to &(str, uint)
421
421
/// This is the entry point of unwinding for fail!() and assert!().
422
422
#[ inline( never) ] #[ cold] // avoid code bloat at the call sites as much as possible
423
423
pub 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) -> !
429
429
// failing.
430
430
431
431
// 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) )
439
433
}
440
434
441
435
/// The core of the unwinding.
@@ -448,9 +442,7 @@ pub fn begin_unwind_no_time_to_explain(file: &'static str, line: uint) -> ! {
448
442
/// Do this split took the LLVM IR line counts of `fn main() { fail!()
449
443
/// }` from ~1900/3700 (-O/no opts) to 180/590.
450
444
#[ 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 ) ) -> ! {
454
446
// First, invoke call the user-defined callbacks triggered on task failure.
455
447
//
456
448
// 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>,
467
459
0 => { }
468
460
n => {
469
461
let f: Callback = unsafe { mem:: transmute ( n) } ;
462
+ let ( file, line) = * file_line;
470
463
f ( msg, file, line) ;
471
464
}
472
465
}
0 commit comments