@@ -49,14 +49,14 @@ compile_error!(
49
49
/// the actual formatting into this shared place.
50
50
// If panic=immediate-abort, inline the abort call,
51
51
// otherwise avoid inlining because of it is cold path.
52
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold) ]
53
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
52
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold) ]
53
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
54
54
#[ track_caller]
55
55
#[ lang = "panic_fmt" ] // needed for const-evaluated panics
56
56
#[ rustc_do_not_const_check] // hooked by const-eval
57
57
#[ rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
58
58
pub const fn panic_fmt ( fmt : fmt:: Arguments < ' _ > ) -> ! {
59
- if cfg ! ( panic = "immediate_abort " ) {
59
+ if cfg ! ( panic = "immediate-abort " ) {
60
60
super :: intrinsics:: abort ( )
61
61
}
62
62
@@ -81,8 +81,8 @@ pub const fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
81
81
/// Like `panic_fmt`, but for non-unwinding panics.
82
82
///
83
83
/// Has to be a separate function so that it can carry the `rustc_nounwind` attribute.
84
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold) ]
85
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
84
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold) ]
85
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
86
86
#[ track_caller]
87
87
// This attribute has the key side-effect that if the panic handler ignores `can_unwind`
88
88
// and unwinds anyway, we will hit the "unwinding out of nounwind function" guard,
@@ -97,7 +97,7 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo
97
97
// We don't unwind anyway at compile-time so we can call the regular `panic_fmt`.
98
98
panic_fmt( fmt)
99
99
} else #[ track_caller] {
100
- if cfg!( panic = "immediate_abort " ) {
100
+ if cfg!( panic = "immediate-abort " ) {
101
101
super :: intrinsics:: abort( )
102
102
}
103
103
@@ -128,8 +128,8 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo
128
128
/// The underlying implementation of core's `panic!` macro when no formatting is used.
129
129
// Never inline unless panic=immediate-abort to avoid code
130
130
// bloat at the call sites as much as possible.
131
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold) ]
132
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
131
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold) ]
132
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
133
133
#[ track_caller]
134
134
#[ rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
135
135
#[ lang = "panic" ] // used by lints and miri for panics
@@ -163,8 +163,8 @@ macro_rules! panic_const {
163
163
//
164
164
// never inline unless panic=immediate-abort to avoid code
165
165
// bloat at the call sites as much as possible
166
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold) ]
167
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
166
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold) ]
167
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
168
168
#[ track_caller]
169
169
#[ rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
170
170
#[ lang = stringify!( $lang) ]
@@ -219,8 +219,8 @@ pub mod panic_const {
219
219
220
220
/// Like `panic`, but without unwinding and track_caller to reduce the impact on codesize on the caller.
221
221
/// If you want `#[track_caller]` for nicer errors, call `panic_nounwind_fmt` directly.
222
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold) ]
223
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
222
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold) ]
223
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
224
224
#[ lang = "panic_nounwind" ] // needed by codegen for non-unwinding panics
225
225
#[ rustc_nounwind]
226
226
#[ rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
@@ -229,8 +229,8 @@ pub const fn panic_nounwind(expr: &'static str) -> ! {
229
229
}
230
230
231
231
/// Like `panic_nounwind`, but also inhibits showing a backtrace.
232
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold) ]
233
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
232
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold) ]
233
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
234
234
#[ rustc_nounwind]
235
235
pub fn panic_nounwind_nobacktrace ( expr : & ' static str ) -> ! {
236
236
panic_nounwind_fmt ( fmt:: Arguments :: new_const ( & [ expr] ) , /* force_no_backtrace */ true ) ;
@@ -262,25 +262,25 @@ pub const fn panic_display<T: fmt::Display>(x: &T) -> ! {
262
262
panic_fmt ( format_args ! ( "{}" , * x) ) ;
263
263
}
264
264
265
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
266
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
265
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
266
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
267
267
#[ track_caller]
268
268
#[ lang = "panic_bounds_check" ] // needed by codegen for panic on OOB array/slice access
269
269
fn panic_bounds_check ( index : usize , len : usize ) -> ! {
270
- if cfg ! ( panic = "immediate_abort " ) {
270
+ if cfg ! ( panic = "immediate-abort " ) {
271
271
super :: intrinsics:: abort ( )
272
272
}
273
273
274
274
panic ! ( "index out of bounds: the len is {len} but the index is {index}" )
275
275
}
276
276
277
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
278
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
277
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
278
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
279
279
#[ track_caller]
280
280
#[ lang = "panic_misaligned_pointer_dereference" ] // needed by codegen for panic on misaligned pointer deref
281
281
#[ rustc_nounwind] // `CheckAlignment` MIR pass requires this function to never unwind
282
282
fn panic_misaligned_pointer_dereference ( required : usize , found : usize ) -> ! {
283
- if cfg ! ( panic = "immediate_abort " ) {
283
+ if cfg ! ( panic = "immediate-abort " ) {
284
284
super :: intrinsics:: abort ( )
285
285
}
286
286
@@ -292,13 +292,13 @@ fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
292
292
)
293
293
}
294
294
295
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
296
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
295
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
296
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
297
297
#[ track_caller]
298
298
#[ lang = "panic_null_pointer_dereference" ] // needed by codegen for panic on null pointer deref
299
299
#[ rustc_nounwind] // `CheckNull` MIR pass requires this function to never unwind
300
300
fn panic_null_pointer_dereference ( ) -> ! {
301
- if cfg ! ( panic = "immediate_abort " ) {
301
+ if cfg ! ( panic = "immediate-abort " ) {
302
302
super :: intrinsics:: abort ( )
303
303
}
304
304
@@ -308,13 +308,13 @@ fn panic_null_pointer_dereference() -> ! {
308
308
)
309
309
}
310
310
311
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
312
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
311
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
312
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
313
313
#[ track_caller]
314
314
#[ lang = "panic_invalid_enum_construction" ] // needed by codegen for panic on invalid enum construction.
315
315
#[ rustc_nounwind] // `CheckEnums` MIR pass requires this function to never unwind
316
316
fn panic_invalid_enum_construction ( source : u128 ) -> ! {
317
- if cfg ! ( panic = "immediate_abort " ) {
317
+ if cfg ! ( panic = "immediate-abort " ) {
318
318
super :: intrinsics:: abort ( )
319
319
}
320
320
@@ -331,8 +331,8 @@ fn panic_invalid_enum_construction(source: u128) -> ! {
331
331
///
332
332
/// This function is called directly by the codegen backend, and must not have
333
333
/// any extra arguments (including those synthesized by track_caller).
334
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
335
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
334
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
335
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
336
336
#[ lang = "panic_cannot_unwind" ] // needed by codegen for panic in nounwind function
337
337
#[ rustc_nounwind]
338
338
fn panic_cannot_unwind ( ) -> ! {
@@ -347,8 +347,8 @@ fn panic_cannot_unwind() -> ! {
347
347
///
348
348
/// This function is called directly by the codegen backend, and must not have
349
349
/// any extra arguments (including those synthesized by track_caller).
350
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
351
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
350
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
351
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
352
352
#[ lang = "panic_in_cleanup" ] // needed by codegen for panic in nounwind function
353
353
#[ rustc_nounwind]
354
354
fn panic_in_cleanup ( ) -> ! {
@@ -380,8 +380,8 @@ pub enum AssertKind {
380
380
}
381
381
382
382
/// Internal function for `assert_eq!` and `assert_ne!` macros
383
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
384
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
383
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
384
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
385
385
#[ track_caller]
386
386
#[ doc( hidden) ]
387
387
pub fn assert_failed < T , U > (
@@ -398,8 +398,8 @@ where
398
398
}
399
399
400
400
/// Internal function for `assert_match!`
401
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
402
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
401
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
402
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
403
403
#[ track_caller]
404
404
#[ doc( hidden) ]
405
405
pub fn assert_matches_failed < T : fmt:: Debug + ?Sized > (
@@ -418,8 +418,8 @@ pub fn assert_matches_failed<T: fmt::Debug + ?Sized>(
418
418
}
419
419
420
420
/// Non-generic version of the above functions, to avoid code bloat.
421
- #[ cfg_attr( not( panic = "immediate_abort " ) , inline( never) , cold, optimize( size) ) ]
422
- #[ cfg_attr( panic = "immediate_abort " , inline) ]
421
+ #[ cfg_attr( not( panic = "immediate-abort " ) , inline( never) , cold, optimize( size) ) ]
422
+ #[ cfg_attr( panic = "immediate-abort " , inline) ]
423
423
#[ track_caller]
424
424
fn assert_failed_inner (
425
425
kind : AssertKind ,
0 commit comments