summaryrefslogtreecommitdiffstats
path: root/library/core/src/num/int_log10.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/src/num/int_log10.rs')
-rw-r--r--library/core/src/num/int_log10.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/num/int_log10.rs b/library/core/src/num/int_log10.rs
index 80472528f..0ce31b40a 100644
--- a/library/core/src/num/int_log10.rs
+++ b/library/core/src/num/int_log10.rs
@@ -138,3 +138,11 @@ pub const fn i64(val: i64) -> u32 {
pub const fn i128(val: i128) -> u32 {
u128(val as u128)
}
+
+/// Instantiate this panic logic once, rather than for all the ilog methods
+/// on every single primitive type.
+#[cold]
+#[track_caller]
+pub const fn panic_for_nonpositive_argument() -> ! {
+ panic!("argument of integer logarithm must be positive")
+}