Skip to content

Commit 3f1c95e

Browse files
committed
Auto merge of #117804 - saethlin:no-recursive-panics, r=<try>
Panic directly in Arguments::new* instead of recursing This has been bothering me because it looks very silly in MIR. Maybe the simpler form is faster? It surely inlines more... but is that good? r? `@ghost`
2 parents 6f308b8 + ca211ea commit 3f1c95e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/fmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<'a> Arguments<'a> {
320320
#[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")]
321321
pub const fn new_const(pieces: &'a [&'static str]) -> Self {
322322
if pieces.len() > 1 {
323-
panic!("invalid args");
323+
crate::panicking::panic("invalid args");
324324
}
325325
Arguments { pieces, fmt: None, args: &[] }
326326
}
@@ -330,7 +330,7 @@ impl<'a> Arguments<'a> {
330330
#[inline]
331331
pub fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> {
332332
if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
333-
panic!("invalid args");
333+
crate::panicking::panic("invalid args");
334334
}
335335
Arguments { pieces, fmt: None, args }
336336
}

0 commit comments

Comments
 (0)