@@ -518,7 +518,7 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments,
518
518
519
519
let mut s = String :: new ( ) ;
520
520
let _ = s. write_fmt ( * msg) ;
521
- begin_panic_new ( s, file_line_col)
521
+ begin_panic ( s, file_line_col)
522
522
}
523
523
524
524
// FIXME: In PR #42938, we have added the column as info passed to the panic
@@ -529,15 +529,17 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments,
529
529
// By changing the compiler source, we can only affect behaviour of higher
530
530
// stages. We need to perform the switch over two stage0 replacements, using
531
531
// a temporary function begin_panic_new while performing the switch:
532
- // 0. Right now, we tell stage1 onward to emit a call to begin_panic_new.
533
- // 1. In the first SNAP, stage0 calls begin_panic_new with the new ABI,
534
- // begin_panic stops being used. Now we can change begin_panic to
535
- // the new ABI, and start emitting calls to begin_panic in higher
532
+ // 0. Before the current switch, we told stage1 onward to emit a call
533
+ // to begin_panic_new.
534
+ // 1. Right now, stage0 calls begin_panic_new with the new ABI,
535
+ // begin_panic stops being used. We have changed begin_panic to
536
+ // the new ABI, and started to emit calls to begin_panic in higher
536
537
// stages again, this time with the new ABI.
537
538
// 2. After the second SNAP, stage0 calls begin_panic with the new ABI,
538
539
// and we can remove the temporary begin_panic_new function.
539
540
540
541
/// This is the entry point of panicking for panic!() and assert!().
542
+ #[ cfg( stage0) ]
541
543
#[ unstable( feature = "libstd_sys_internals" ,
542
544
reason = "used by the panic! macro" ,
543
545
issue = "0" ) ]
@@ -558,18 +560,15 @@ pub fn begin_panic_new<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32
558
560
reason = "used by the panic! macro" ,
559
561
issue = "0" ) ]
560
562
#[ inline( never) ] #[ cold] // avoid code bloat at the call sites as much as possible
561
- pub fn begin_panic < M : Any + Send > ( msg : M , file_line : & ( & ' static str , u32 ) ) -> ! {
563
+ pub fn begin_panic < M : Any + Send > ( msg : M , file_line_col : & ( & ' static str , u32 , u32 ) ) -> ! {
562
564
// Note that this should be the only allocation performed in this code path.
563
565
// Currently this means that panic!() on OOM will invoke this code path,
564
566
// but then again we're not really ready for panic on OOM anyway. If
565
567
// we do start doing this, then we should propagate this allocation to
566
568
// be performed in the parent of this thread instead of the thread that's
567
569
// panicking.
568
570
569
- let ( file, line) = * file_line;
570
- let file_line_col = ( file, line, 0 ) ;
571
-
572
- rust_panic_with_hook ( Box :: new ( msg) , & file_line_col)
571
+ rust_panic_with_hook ( Box :: new ( msg) , file_line_col)
573
572
}
574
573
575
574
/// Executes the primary logic for a panic, including checking for recursive
0 commit comments