@@ -39,8 +39,12 @@ use crate::panic::{Location, PanicInfo};
39
39
#[ lang = "panic" ] // needed by codegen for panic on overflow and other `Assert` MIR terminators
40
40
pub fn panic ( expr : & str ) -> ! {
41
41
if cfg ! ( feature = "panic_immediate_abort" ) {
42
+ // remove `unsafe` (and safety comment) on bootstrap bump
43
+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ]
42
44
// SAFETY: the `abort` intrinsic has no requirements to be called.
43
- unsafe { super :: intrinsics:: abort ( ) }
45
+ unsafe {
46
+ super :: intrinsics:: abort ( )
47
+ }
44
48
}
45
49
46
50
// Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially
@@ -58,8 +62,12 @@ pub fn panic(expr: &str) -> ! {
58
62
#[ lang = "panic_bounds_check" ] // needed by codegen for panic on OOB array/slice access
59
63
fn panic_bounds_check ( index : usize , len : usize ) -> ! {
60
64
if cfg ! ( feature = "panic_immediate_abort" ) {
65
+ // remove `unsafe` (and safety comment) on bootstrap bump
66
+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ]
61
67
// SAFETY: the `abort` intrinsic has no requirements to be called.
62
- unsafe { super :: intrinsics:: abort ( ) }
68
+ unsafe {
69
+ super :: intrinsics:: abort ( )
70
+ }
63
71
}
64
72
65
73
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) -> ! {
72
80
#[ track_caller]
73
81
pub fn panic_fmt ( fmt : fmt:: Arguments < ' _ > ) -> ! {
74
82
if cfg ! ( feature = "panic_immediate_abort" ) {
83
+ // remove `unsafe` (and safety comment) on bootstrap bump
84
+ #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ]
75
85
// SAFETY: the `abort` intrinsic has no requirements to be called.
76
- unsafe { super :: intrinsics:: abort ( ) }
86
+ unsafe {
87
+ super :: intrinsics:: abort ( )
88
+ }
77
89
}
78
90
79
91
// NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call
0 commit comments