Skip to content

Commit 378c8fc

Browse files
committed
Auto merge of rust-lang#124863 - DaniPopes:from-str-radix-panic, r=Amanieu
from_str_radix: outline only the panic function In the `{integer}::from_str_radix` function, the radix check is labeled as `cold` and `inline(never)`, along with its corresponding panic. It probably was intended to apply these attributes only to the panic function.
2 parents 8c54418 + a69f31c commit 378c8fc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: core/src/num/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1412,11 +1412,9 @@ fn from_str_radix_panic_rt(radix: u32) -> ! {
14121412
#[cfg_attr(feature = "panic_immediate_abort", inline)]
14131413
#[cold]
14141414
#[track_caller]
1415-
const fn from_str_radix_assert(radix: u32) {
1416-
if 2 > radix || radix > 36 {
1417-
// The only difference between these two functions is their panic message.
1418-
intrinsics::const_eval_select((radix,), from_str_radix_panic_ct, from_str_radix_panic_rt);
1419-
}
1415+
const fn from_str_radix_panic(radix: u32) {
1416+
// The only difference between these two functions is their panic message.
1417+
intrinsics::const_eval_select((radix,), from_str_radix_panic_ct, from_str_radix_panic_rt);
14201418
}
14211419

14221420
macro_rules! from_str_radix {
@@ -1450,7 +1448,9 @@ macro_rules! from_str_radix {
14501448
use self::IntErrorKind::*;
14511449
use self::ParseIntError as PIE;
14521450

1453-
from_str_radix_assert(radix);
1451+
if 2 > radix || radix > 36 {
1452+
from_str_radix_panic(radix);
1453+
}
14541454

14551455
if src.is_empty() {
14561456
return Err(PIE { kind: Empty });

0 commit comments

Comments
 (0)