Skip to content

Commit 2d7d90a

Browse files
committed
alloc.undef
1 parent adb4c83 commit 2d7d90a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/librustc/mir/interpret/allocation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::{
55
};
66

77
use crate::mir;
8-
use crate::ty::layout::{Size, Align};
8+
use crate::ty::layout::{Size, MemoryPosition, Align};
99

1010
use rustc_data_structures::sorted_map::SortedMap;
1111
use rustc_target::abi::HasDataLayout;
@@ -116,14 +116,14 @@ impl<Tag> Allocation<Tag> {
116116
Allocation::from_bytes(slice, Align::from_bytes(1).unwrap())
117117
}
118118

119-
pub fn undef(size: Size, align: Align) -> Self {
120-
assert_eq!(size.bytes() as usize as u64, size.bytes());
119+
pub fn undef(mem_pos: MemoryPosition) -> Self {
120+
assert_eq!(mem_pos.size.bytes() as usize as u64, mem_pos.size.bytes());
121121
Allocation {
122-
bytes: vec![0; size.bytes() as usize],
122+
bytes: vec![0; mem_pos.size.bytes() as usize],
123123
relocations: Relocations::new(),
124-
undef_mask: UndefMask::new(size, false),
125-
size,
126-
align,
124+
undef_mask: UndefMask::new(mem_pos.size, false),
125+
size: mem_pos.size,
126+
align: mem_pos.align,
127127
mutability: Mutability::Mutable,
128128
extra: (),
129129
}

src/librustc_mir/interpret/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
168168
mem_pos: MemoryPosition,
169169
kind: MemoryKind<M::MemoryKinds>,
170170
) -> Pointer<M::PointerTag> {
171-
let alloc = Allocation::undef(mem_pos.size, mem_pos.align);
171+
let alloc = Allocation::undef(mem_pos);
172172
self.allocate_with(alloc, kind)
173173
}
174174

0 commit comments

Comments
 (0)