rename is_valid_for to is_valid

This commit is contained in:
Andreas Liljeqvist 2021-09-07 20:51:09 +02:00
parent dd34e0c966
commit 9095cf9905
4 changed files with 5 additions and 5 deletions

View file

@ -541,7 +541,7 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
// become 0..0 when the type becomes i1, which would be rejected
// by the LLVM verifier.
if let Int(..) = scalar.value {
if !scalar.is_bool() && !scalar.is_always_valid_for(bx) {
if !scalar.is_bool() && !scalar.is_always_valid(bx) {
bx.range_metadata(callsite, scalar.valid_range);
}
}

View file

@ -464,7 +464,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
) {
match scalar.value {
abi::Int(..) => {
if !scalar.is_always_valid_for(bx) {
if !scalar.is_always_valid(bx) {
bx.range_metadata(load, scalar.valid_range);
}
}

View file

@ -308,7 +308,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// then `i1 1` (i.e., E::B) is effectively `i8 -1`.
signed = !scalar.is_bool() && s;
if !scalar.is_always_valid_for(bx.cx())
if !scalar.is_always_valid(bx.cx())
&& scalar.valid_range.end >= scalar.valid_range.start
{
// We want `table[e as usize ± k]` to not

View file

@ -830,7 +830,7 @@ impl Scalar {
/// Returns `true` if all possible numbers are valid, i.e `valid_range` covers the whole layout
#[inline]
pub fn is_always_valid_for<C: HasDataLayout>(&self, cx: &C) -> bool {
pub fn is_always_valid<C: HasDataLayout>(&self, cx: &C) -> bool {
self.valid_range.is_full_for(self.value.size(cx))
}
}
@ -1280,7 +1280,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
s.valid_range.contains(0)
} else {
// The range must include all values.
s.is_always_valid_for(cx)
s.is_always_valid(cx)
}
};