about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniPopes <57450786+DaniPopes@users.noreply.github.com>2024-05-08 00:20:06 +0200
committerDaniPopes <57450786+DaniPopes@users.noreply.github.com>2024-05-08 00:20:06 +0200
commiteac37b6caf00aa9376198c906f19e3e6e850bcab (patch)
tree3fb3ddf4f243954d08804788d949a02ff5256a48
parentfaefc618cf48bd794cbc808448df1bf3f59f36af (diff)
downloadrust-eac37b6caf00aa9376198c906f19e3e6e850bcab.tar.gz
rust-eac37b6caf00aa9376198c906f19e3e6e850bcab.zip
from_str_radix: outline only the panic function
-rw-r--r--library/core/src/num/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
index c02f73fdf03..09a341e4d80 100644
--- a/library/core/src/num/mod.rs
+++ b/library/core/src/num/mod.rs
@@ -1412,11 +1412,9 @@ fn from_str_radix_panic_rt(radix: u32) -> ! {
 #[cfg_attr(feature = "panic_immediate_abort", inline)]
 #[cold]
 #[track_caller]
-const fn from_str_radix_assert(radix: u32) {
-    if 2 > radix || radix > 36 {
-        // The only difference between these two functions is their panic message.
-        intrinsics::const_eval_select((radix,), from_str_radix_panic_ct, from_str_radix_panic_rt);
-    }
+const fn from_str_radix_panic(radix: u32) {
+    // The only difference between these two functions is their panic message.
+    intrinsics::const_eval_select((radix,), from_str_radix_panic_ct, from_str_radix_panic_rt);
 }
 
 macro_rules! from_str_radix {
@@ -1450,7 +1448,9 @@ macro_rules! from_str_radix {
                 use self::IntErrorKind::*;
                 use self::ParseIntError as PIE;
 
-                from_str_radix_assert(radix);
+                if 2 > radix || radix > 36 {
+                    from_str_radix_panic(radix);
+                }
 
                 if src.is_empty() {
                     return Err(PIE { kind: Empty });