From 0d745af29a7566538277bd7a3b16faf09df7fe63 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sat, 4 Nov 2017 17:10:51 -0700 Subject: [PATCH] Use Add::add for overflow checks instead of [rustc_inherit_overflow_checks] --- src/libcore/num/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 914b3762d80..a50779bedfd 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -15,6 +15,7 @@ use convert::{Infallible, TryFrom}; use fmt; use intrinsics; +use ops; use str::FromStr; /// Provides intentionally-wrapped arithmetic on `T`. @@ -2222,9 +2223,9 @@ 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 + // Call the trait to get overflow checks + ops::Add::add(self.one_less_than_next_power_of_two(), 1) } /// Returns the smallest power of two greater than or equal to `n`. If -- 2.44.0