]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/num/int_macros.rs
Rollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
[rust.git] / library / core / src / num / int_macros.rs
index 6f7c5a6d119945fe5acc75bf55d09b2a90b0e694..79436c8e8ede485c5fc93fadd00c1cd6a6e8ffb0 100644 (file)
@@ -2362,7 +2362,11 @@ pub const fn checked_log2(self) -> Option<u32> {
                       without modifying the original"]
         #[inline]
         pub const fn checked_log10(self) -> Option<u32> {
-            int_log10::$ActualT(self as $ActualT)
+            if self > 0 {
+                Some(int_log10::$ActualT(self as $ActualT))
+            } else {
+                None
+            }
         }
 
         /// Computes the absolute value of `self`.