]> git.lizzy.rs Git - rust.git/commitdiff
Fix #18604: next_power_of_two should panic on overflow
authorScott McMurray <scottmcm@users.noreply.github.com>
Sat, 4 Nov 2017 04:48:33 +0000 (21:48 -0700)
committerScott McMurray <scottmcm@users.noreply.github.com>
Sat, 4 Nov 2017 04:48:33 +0000 (21:48 -0700)
src/libcore/num/mod.rs

index 5799d37c19cc6f28400fabf3fe1607678e3f862e..914b3762d808e16f100d67a5434c536ba7327d11 100644 (file)
@@ -2222,6 +2222,7 @@ fn one_less_than_next_power_of_two(self) -> Self {
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
+        #[rustc_inherit_overflow_checks]
         pub fn next_power_of_two(self) -> Self {
             self.one_less_than_next_power_of_two() + 1
         }