diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index bfbfffeb3b8c..d3f87f16313d 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -143,6 +143,11 @@ impl Allocation { pub fn inspect_with_undef_and_ptr_outside_interpreter(&self, range: Range) -> &[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 {} diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 15180265ad29..f7576a41e0f0 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -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;