From 39bfb3626c04fe03d50864e13a6baeed1c0378f4 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 6 Sep 2019 11:10:53 +0200 Subject: [PATCH] Fix miri --- src/librustc/mir/interpret/allocation.rs | 28 ++++++++++++++++++++++++ src/tools/miri | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index df1d9a987011d..13552a61acb0e 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -130,6 +130,34 @@ impl Allocation { } } +impl Allocation<()> { + /// Add Tag and Extra fields + pub fn retag( + self, + mut tagger: impl FnMut(AllocId) -> T, + extra: E, + ) -> Allocation { + Allocation { + bytes: self.bytes, + size: self.size, + relocations: Relocations::from_presorted( + self.relocations.iter() + // The allocations in the relocations (pointers stored *inside* this allocation) + // all get the base pointer tag. + .map(|&(offset, ((), alloc))| { + let tag = tagger(alloc); + (offset, (tag, alloc)) + }) + .collect() + ), + undef_mask: self.undef_mask, + align: self.align, + mutability: self.mutability, + extra, + } + } +} + /// Raw accessors. Provide access to otherwise private bytes. impl Allocation { pub fn len(&self) -> usize { diff --git a/src/tools/miri b/src/tools/miri index 69268fb75fdb4..e479ab26406ed 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit 69268fb75fdb452296caa9bc4aaeff1674279de2 +Subproject commit e479ab26406ed8a473987e5f4a1f3be3e978e5d2