File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -340,7 +340,9 @@ impl<'a> Arguments<'a> {
340
340
#[ rustc_const_unstable( feature = "const_fmt_arguments_new" , issue = "none" ) ]
341
341
pub const fn new_const ( pieces : & ' a [ & ' static str ] ) -> Self {
342
342
if pieces. len ( ) > 1 {
343
- panic ! ( "invalid args" ) ;
343
+ // Since panic!() expands to panic_fmt(format_args!()), using panic! here is both a
344
+ // bit silly and also significantly increases the amount of MIR generated by panics.
345
+ crate :: panicking:: panic_nounwind ( "invalid args" ) ;
344
346
}
345
347
Arguments { pieces, fmt : None , args : & [ ] }
346
348
}
@@ -350,7 +352,8 @@ impl<'a> Arguments<'a> {
350
352
#[ inline]
351
353
pub fn new_v1 ( pieces : & ' a [ & ' static str ] , args : & ' a [ rt:: Argument < ' a > ] ) -> Arguments < ' a > {
352
354
if pieces. len ( ) < args. len ( ) || pieces. len ( ) > args. len ( ) + 1 {
353
- panic ! ( "invalid args" ) ;
355
+ // See Arguments::new_const for why we don't use panic!.
356
+ crate :: panicking:: panic_nounwind ( "invalid args" ) ;
354
357
}
355
358
Arguments { pieces, fmt : None , args }
356
359
}
You can’t perform that action at this time.
0 commit comments