diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 8e7be6bcca1..c7b1a805223 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -468,7 +468,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { bx.range_metadata(load, &scalar.valid_range); } } - abi::Pointer if !scalar.valid_range.contains_zero() => { + abi::Pointer if !scalar.valid_range.contains(0) => { bx.nonnull_metadata(load); } _ => {} diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index f7ab9dd82ac..9f9806f272e 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -2921,7 +2921,7 @@ where return; } - if !scalar.valid_range.contains_zero() { + if !scalar.valid_range.contains(0) { attrs.set(ArgAttribute::NonNull); } diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs index 85c0d022e8e..7e9fc41d10f 100644 --- a/compiler/rustc_target/src/abi/mod.rs +++ b/compiler/rustc_target/src/abi/mod.rs @@ -759,13 +759,6 @@ impl WrappingRange { } } - /// Returns `true` if zero is contained in the range. - /// Equal to `range.contains(0)` but should be faster. - #[inline(always)] - pub fn contains_zero(&self) -> bool { - self.start > self.end || self.start == 0 - } - /// Returns `self` with replaced `start` #[inline(always)] pub fn with_start(mut self, start: u128) -> Self { @@ -1266,7 +1259,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { let scalar_allows_raw_init = move |s: &Scalar| -> bool { if zero { // The range must contain 0. - s.valid_range.contains_zero() + s.valid_range.contains(0) } else { // The range must include all values. s.is_always_valid_for(cx)