@@ -264,7 +264,7 @@ pub const fn panic_display<T: fmt::Display>(x: &T) -> ! {
264
264
panic_fmt ( format_args ! ( "{}" , * x) ) ;
265
265
}
266
266
267
- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
267
+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
268
268
#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
269
269
#[ track_caller]
270
270
#[ lang = "panic_bounds_check" ] // needed by codegen for panic on OOB array/slice access
@@ -276,7 +276,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
276
276
panic ! ( "index out of bounds: the len is {len} but the index is {index}" )
277
277
}
278
278
279
- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
279
+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
280
280
#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
281
281
#[ track_caller]
282
282
#[ lang = "panic_misaligned_pointer_dereference" ] // needed by codegen for panic on misaligned pointer deref
@@ -301,7 +301,7 @@ fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
301
301
///
302
302
/// This function is called directly by the codegen backend, and must not have
303
303
/// any extra arguments (including those synthesized by track_caller).
304
- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
304
+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
305
305
#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
306
306
#[ lang = "panic_cannot_unwind" ] // needed by codegen for panic in nounwind function
307
307
#[ rustc_nounwind]
@@ -317,7 +317,7 @@ fn panic_cannot_unwind() -> ! {
317
317
///
318
318
/// This function is called directly by the codegen backend, and must not have
319
319
/// any extra arguments (including those synthesized by track_caller).
320
- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
320
+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
321
321
#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
322
322
#[ lang = "panic_in_cleanup" ] // needed by codegen for panic in nounwind function
323
323
#[ rustc_nounwind]
@@ -350,7 +350,7 @@ pub enum AssertKind {
350
350
}
351
351
352
352
/// Internal function for `assert_eq!` and `assert_ne!` macros
353
- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
353
+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
354
354
#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
355
355
#[ track_caller]
356
356
#[ doc( hidden) ]
@@ -368,7 +368,7 @@ where
368
368
}
369
369
370
370
/// Internal function for `assert_match!`
371
- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
371
+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
372
372
#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
373
373
#[ track_caller]
374
374
#[ doc( hidden) ]
@@ -388,7 +388,7 @@ pub fn assert_matches_failed<T: fmt::Debug + ?Sized>(
388
388
}
389
389
390
390
/// Non-generic version of the above functions, to avoid code bloat.
391
- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
391
+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
392
392
#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
393
393
#[ track_caller]
394
394
fn assert_failed_inner (
0 commit comments