Remove contains_zero, respect the compiler

This commit is contained in:
Andreas Liljeqvist 2021-08-28 11:11:33 +02:00
parent 021c3346ed
commit f5d8749f85
3 changed files with 3 additions and 10 deletions

View File

@ -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);
}
_ => {}

View File

@ -2921,7 +2921,7 @@ where
return;
}
if !scalar.valid_range.contains_zero() {
if !scalar.valid_range.contains(0) {
attrs.set(ArgAttribute::NonNull);
}

View File

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