@@ -264,7 +264,7 @@ pub const fn panic_display<T: fmt::Display>(x: &T) -> ! {
264264 panic_fmt ( format_args ! ( "{}" , * x) ) ;
265265}
266266
267- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
267+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
268268#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
269269#[ track_caller]
270270#[ 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) -> ! {
276276 panic ! ( "index out of bounds: the len is {len} but the index is {index}" )
277277}
278278
279- #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold) ]
279+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) , cold, optimize ( size ) ) ]
280280#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
281281#[ track_caller]
282282#[ 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) -> ! {
301301///
302302/// This function is called directly by the codegen backend, and must not have
303303/// 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 ) ) ]
305305#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
306306#[ lang = "panic_cannot_unwind" ] // needed by codegen for panic in nounwind function
307307#[ rustc_nounwind]
@@ -317,7 +317,7 @@ fn panic_cannot_unwind() -> ! {
317317///
318318/// This function is called directly by the codegen backend, and must not have
319319/// 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 ) ) ]
321321#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
322322#[ lang = "panic_in_cleanup" ] // needed by codegen for panic in nounwind function
323323#[ rustc_nounwind]
@@ -350,7 +350,7 @@ pub enum AssertKind {
350350}
351351
352352/// 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 ) ) ]
354354#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
355355#[ track_caller]
356356#[ doc( hidden) ]
@@ -368,7 +368,7 @@ where
368368}
369369
370370/// 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 ) ) ]
372372#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
373373#[ track_caller]
374374#[ doc( hidden) ]
@@ -388,7 +388,7 @@ pub fn assert_matches_failed<T: fmt::Debug + ?Sized>(
388388}
389389
390390/// 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 ) ) ]
392392#[ cfg_attr( feature = "panic_immediate_abort" , inline) ]
393393#[ track_caller]
394394fn assert_failed_inner (
0 commit comments