提交 9492038a 编写于 作者: R Ralf Jung

make code more symmetric

上级 9c32ede0
......@@ -128,15 +128,17 @@ pub fn read_size_and_align_from_vtable(
) -> InterpResult<'tcx, (Size, Align)> {
let pointer_size = self.pointer_size();
// We check for size = 3*ptr_size, that covers the drop fn (unused here),
// the size, and the align.
// the size, and the align (which we read below).
let vtable = self.memory.check_ptr_access(
vtable,
3*pointer_size,
self.tcx.data_layout.pointer_align.abi,
)?.expect("cannot be a ZST");
let alloc = self.memory.get(vtable.alloc_id)?;
let size = alloc.read_ptr_sized(self, vtable.offset(pointer_size, self)?)?
.to_bits(pointer_size)? as u64;
let size = alloc.read_ptr_sized(
self,
vtable.offset(pointer_size, self)?
)?.to_bits(pointer_size)? as u64;
let align = alloc.read_ptr_sized(
self,
vtable.offset(pointer_size * 2, self)?,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册