Fix #18604: next_power_of_two should panic on overflow

This commit is contained in:
Scott McMurray 2017-11-03 21:48:33 -07:00
parent 2278506f68
commit 15ea3d80da

View file

@ -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
}