Skip to content
Permalink
Browse files

Fix miri

  • Loading branch information...
oli-obk committed Sep 6, 2019
1 parent 9776723 commit 39bfb3626c04fe03d50864e13a6baeed1c0378f4
Showing with 29 additions and 1 deletion.
  1. +28 −0 src/librustc/mir/interpret/allocation.rs
  2. +1 −1 src/tools/miri
@@ -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 {

0 comments on commit 39bfb36

Please sign in to comment.
You can’t perform that action at this time.