Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7b941e3

Browse files
committed
Expose encapsulated undef mask as immutable
1 parent d8c5bc7 commit 7b941e3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/librustc/mir/interpret/allocation.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
143143
pub fn inspect_with_undef_and_ptr_outside_interpreter(&self, range: Range<usize>) -> &[u8] {
144144
&self.bytes[range]
145145
}
146+
147+
/// View the undef mask.
148+
pub fn undef_mask(&self) -> &UndefMask {
149+
&self.undef_mask
150+
}
146151
}
147152

148153
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Allocation {}

src/librustc_mir/interpret/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
653653
}
654654
relocations.push((i, target_id));
655655
}
656-
if alloc.undef_mask.is_range_defined(i, i + Size::from_bytes(1)).is_ok() {
656+
if alloc.undef_mask().is_range_defined(i, i + Size::from_bytes(1)).is_ok() {
657657
// this `as usize` is fine, since `i` came from a `usize`
658658
let i = i.bytes() as usize;
659659

0 commit comments

Comments
 (0)