From: Scott McMurray Date: Sat, 4 Nov 2017 04:48:33 +0000 (-0700) Subject: Fix #18604: next_power_of_two should panic on overflow X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=15ea3d80dacc4bb0919655e0f16e808ce83b5cf9;p=rust.git Fix #18604: next_power_of_two should panic on overflow --- diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 5799d37c19c..914b3762d80 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -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 }