diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-09-06 11:10:53 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-09-06 11:10:53 +0200 |
| commit | 39bfb3626c04fe03d50864e13a6baeed1c0378f4 (patch) | |
| tree | 53f4b1ecadab40a00f510551da1cc48fed079a3f | |
| parent | 97767238814fd4bd3ce8a3972184b29fefb4923e (diff) | |
| download | rust-39bfb3626c04fe03d50864e13a6baeed1c0378f4.tar.gz rust-39bfb3626c04fe03d50864e13a6baeed1c0378f4.zip | |
Fix miri
| -rw-r--r-- | src/librustc/mir/interpret/allocation.rs | 28 | ||||
| m--------- | src/tools/miri | 15 |
2 files changed, 33 insertions, 10 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index df1d9a98701..13552a61acb 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -130,6 +130,34 @@ impl<Tag> Allocation<Tag> { } } +impl Allocation<()> { + /// Add Tag and Extra fields + pub fn retag<T, E>( + self, + mut tagger: impl FnMut(AllocId) -> T, + extra: E, + ) -> Allocation<T, E> { + 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<Tag, Extra> Allocation<Tag, Extra> { pub fn len(&self) -> usize { diff --git a/src/tools/miri b/src/tools/miri -Subproject 69268fb75fdb452296caa9bc4aaeff1674279de +Subproject e479ab26406ed8a473987e5f4a1f3be3e978e5d |
