This commit is contained in:
Ralf Jung 2022-05-19 20:34:37 +02:00
parent 42a91ed70c
commit 4bb152c4bc

View File

@ -547,8 +547,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
if M::enforce_number_no_provenance(self.ecx) { if M::enforce_number_no_provenance(self.ecx) {
// As a special exception we *do* match on a `Scalar` here, since we truly want // As a special exception we *do* match on a `Scalar` here, since we truly want
// to know its underlying representation (and *not* cast it to an integer). // to know its underlying representation (and *not* cast it to an integer).
let is_ptr = let is_ptr = value.check_init().map_or(false, |v| matches!(v, Scalar::Ptr(..)));
value.check_init().map_or(false, |v| matches!(v, Scalar::Ptr(..)));
if is_ptr { if is_ptr {
throw_validation_failure!(self.path, throw_validation_failure!(self.path,
{ "{:x}", value } expected { "plain (non-pointer) bytes" } { "{:x}", value } expected { "plain (non-pointer) bytes" }