From f8478df6dcdf92192f0df550145283673c494a73 Mon Sep 17 00:00:00 2001 From: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com> Date: Sat, 14 May 2022 13:03:47 -0500 Subject: [PATCH] Bump rustc for permissive provenance --- rust-version | 2 +- src/machine.rs | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/rust-version b/rust-version index 630aee6793..1c54dc72ba 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -481db40311cdd241ae4d33f34f2f75732e44d8e8 +2d691170885b32502b391b8b1a0d54d2419a5653 diff --git a/src/machine.rs b/src/machine.rs index 5facc5327d..035f5df707 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -158,8 +158,8 @@ impl Provenance for Tag { write!(f, "{:?}", tag.sb) } - fn get_alloc_id(self) -> AllocId { - self.alloc_id + fn get_alloc_id(self) -> Option { + Some(self.alloc_id) } } @@ -600,21 +600,37 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> { } #[inline(always)] - fn ptr_from_addr( + fn ptr_from_addr_cast( ecx: &MiriEvalContext<'mir, 'tcx>, addr: u64, ) -> Pointer> { intptrcast::GlobalStateInner::ptr_from_addr(addr, ecx) } + #[inline(always)] + fn ptr_from_addr_transmute( + ecx: &MiriEvalContext<'mir, 'tcx>, + addr: u64, + ) -> Pointer> { + Self::ptr_from_addr_cast(ecx, addr) + } + + #[inline(always)] + fn expose_ptr( + _ecx: &mut InterpCx<'mir, 'tcx, Self>, + _ptr: Pointer, + ) -> InterpResult<'tcx> { + Ok(()) + } + /// Convert a pointer with provenance into an allocation-offset pair, /// or a `None` with an absolute address if that conversion is not possible. fn ptr_get_alloc( ecx: &MiriEvalContext<'mir, 'tcx>, ptr: Pointer, - ) -> (AllocId, Size, Self::TagExtra) { + ) -> Option<(AllocId, Size, Self::TagExtra)> { let rel = intptrcast::GlobalStateInner::abs_ptr_to_rel(ecx, ptr); - (ptr.provenance.alloc_id, rel, ptr.provenance.sb) + Some((ptr.provenance.alloc_id, rel, ptr.provenance.sb)) } #[inline(always)]