Skip to content

Commit 90d28ea

Browse files
committed
Auto merge of #2116 - carbotaniuman:minimal-miri-changes, r=RalfJung
Minimal miri changes for rustc permissive provenance Simple no-op changes to adapt to new API surface.
2 parents 98c8c8f + f8478df commit 90d28ea

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
481db40311cdd241ae4d33f34f2f75732e44d8e8
1+
2d691170885b32502b391b8b1a0d54d2419a5653

src/machine.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ impl Provenance for Tag {
159159
write!(f, "{:?}", tag.sb)
160160
}
161161

162-
fn get_alloc_id(self) -> AllocId {
163-
self.alloc_id
162+
fn get_alloc_id(self) -> Option<AllocId> {
163+
Some(self.alloc_id)
164164
}
165165
}
166166

@@ -608,21 +608,37 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
608608
}
609609

610610
#[inline(always)]
611-
fn ptr_from_addr(
611+
fn ptr_from_addr_cast(
612612
ecx: &MiriEvalContext<'mir, 'tcx>,
613613
addr: u64,
614614
) -> Pointer<Option<Self::PointerTag>> {
615615
intptrcast::GlobalStateInner::ptr_from_addr(addr, ecx)
616616
}
617617

618+
#[inline(always)]
619+
fn ptr_from_addr_transmute(
620+
ecx: &MiriEvalContext<'mir, 'tcx>,
621+
addr: u64,
622+
) -> Pointer<Option<Self::PointerTag>> {
623+
Self::ptr_from_addr_cast(ecx, addr)
624+
}
625+
626+
#[inline(always)]
627+
fn expose_ptr(
628+
_ecx: &mut InterpCx<'mir, 'tcx, Self>,
629+
_ptr: Pointer<Self::PointerTag>,
630+
) -> InterpResult<'tcx> {
631+
Ok(())
632+
}
633+
618634
/// Convert a pointer with provenance into an allocation-offset pair,
619635
/// or a `None` with an absolute address if that conversion is not possible.
620636
fn ptr_get_alloc(
621637
ecx: &MiriEvalContext<'mir, 'tcx>,
622638
ptr: Pointer<Self::PointerTag>,
623-
) -> (AllocId, Size, Self::TagExtra) {
639+
) -> Option<(AllocId, Size, Self::TagExtra)> {
624640
let rel = intptrcast::GlobalStateInner::abs_ptr_to_rel(ecx, ptr);
625-
(ptr.provenance.alloc_id, rel, ptr.provenance.sb)
641+
Some((ptr.provenance.alloc_id, rel, ptr.provenance.sb))
626642
}
627643

628644
#[inline(always)]

0 commit comments

Comments
 (0)