Expose encapsulated undef mask as immutable

This commit is contained in:
Andreas Molzer 2019-08-14 02:26:18 +02:00
parent d8c5bc7ec6
commit 7b941e368f
2 changed files with 6 additions and 1 deletions

View file

@ -143,6 +143,11 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
pub fn inspect_with_undef_and_ptr_outside_interpreter(&self, range: Range<usize>) -> &[u8] {
&self.bytes[range]
}
/// View the undef mask.
pub fn undef_mask(&self) -> &UndefMask {
&self.undef_mask
}
}
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Allocation {}

View file

@ -653,7 +653,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
}
relocations.push((i, target_id));
}
if alloc.undef_mask.is_range_defined(i, i + Size::from_bytes(1)).is_ok() {
if alloc.undef_mask().is_range_defined(i, i + Size::from_bytes(1)).is_ok() {
// this `as usize` is fine, since `i` came from a `usize`
let i = i.bytes() as usize;