Skip to content

Commit 15ea3d8

Browse files
committed
Fix rust-lang#18604: next_power_of_two should panic on overflow
1 parent 2278506 commit 15ea3d8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libcore/num/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,7 @@ macro_rules! uint_impl {
22222222
/// ```
22232223
#[stable(feature = "rust1", since = "1.0.0")]
22242224
#[inline]
2225+
#[rustc_inherit_overflow_checks]
22252226
pub fn next_power_of_two(self) -> Self {
22262227
self.one_less_than_next_power_of_two() + 1
22272228
}

0 commit comments

Comments
 (0)