about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAndreas Molzer <andreas.molzer@gmx.de>2019-08-14 02:26:18 +0200
committerAndreas Molzer <andreas.molzer@gmx.de>2019-08-21 10:55:16 +0200
commit7b941e368fac6612eacf3423eac0149ef5ca3bb3 (patch)
tree81cf11511dd8fa49993f9e5d59fad833559966f1 /src
parentd8c5bc7ec6ea2501bdbd2853551aa83175d6e8d0 (diff)
downloadrust-7b941e368fac6612eacf3423eac0149ef5ca3bb3.tar.gz
rust-7b941e368fac6612eacf3423eac0149ef5ca3bb3.zip
Expose encapsulated undef mask as immutable
Diffstat (limited to 'src')
-rw-r--r--src/librustc/mir/interpret/allocation.rs5
-rw-r--r--src/librustc_mir/interpret/memory.rs2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs
index bfbfffeb3b8..d3f87f16313 100644
--- a/src/librustc/mir/interpret/allocation.rs
+++ b/src/librustc/mir/interpret/allocation.rs
@@ -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 {}
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs
index 15180265ad2..f7576a41e0f 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;