@@ -39,8 +39,12 @@ use crate::panic::{Location, PanicInfo};
3939#[ lang = "panic" ] // needed by codegen for panic on overflow and other `Assert` MIR terminators
4040pub fn panic ( expr : & str ) -> ! {
4141 if cfg ! ( feature = "panic_immediate_abort" ) {
42+ // remove `unsafe` (and safety comment) on bootstrap bump
43+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ]
4244 // SAFETY: the `abort` intrinsic has no requirements to be called.
43- unsafe { super :: intrinsics:: abort ( ) }
45+ unsafe {
46+ super :: intrinsics:: abort ( )
47+ }
4448 }
4549
4650 // Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially
@@ -58,8 +62,12 @@ pub fn panic(expr: &str) -> ! {
5862#[ lang = "panic_bounds_check" ] // needed by codegen for panic on OOB array/slice access
5963fn panic_bounds_check ( index : usize , len : usize ) -> ! {
6064 if cfg ! ( feature = "panic_immediate_abort" ) {
65+ // remove `unsafe` (and safety comment) on bootstrap bump
66+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ]
6167 // SAFETY: the `abort` intrinsic has no requirements to be called.
62- unsafe { super :: intrinsics:: abort ( ) }
68+ unsafe {
69+ super :: intrinsics:: abort ( )
70+ }
6371 }
6472
6573 panic ! ( "index out of bounds: the len is {} but the index is {}" , len, index)
@@ -72,8 +80,12 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
7280#[ track_caller]
7381pub fn panic_fmt ( fmt : fmt:: Arguments < ' _ > ) -> ! {
7482 if cfg ! ( feature = "panic_immediate_abort" ) {
83+ // remove `unsafe` (and safety comment) on bootstrap bump
84+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ]
7585 // SAFETY: the `abort` intrinsic has no requirements to be called.
76- unsafe { super :: intrinsics:: abort ( ) }
86+ unsafe {
87+ super :: intrinsics:: abort ( )
88+ }
7789 }
7890
7991 // NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call
0 commit comments