Skip to content

Commit

Permalink
Fix #18604: next_power_of_two should panic on overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm committed Nov 4, 2017
1 parent 2278506 commit 15ea3d8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/libcore/num/mod.rs
Expand Up @@ -2222,6 +2222,7 @@ macro_rules! uint_impl {
/// ```
#[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
}
Expand Down

0 comments on commit 15ea3d8

Please sign in to comment.