Skip to content

Commit 2b37d50

Browse files
committed
simplify determining size and alignment of a pointer
1 parent b44babf commit 2b37d50

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/eval_context.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,13 +1704,7 @@ pub fn eval_main<'a, 'tcx: 'a>(
17041704
}
17051705

17061706
// Return value
1707-
let ret_ptr = {
1708-
let ty = ecx.tcx.types.isize;
1709-
let layout = ecx.type_layout_with_substs(ty, Substs::empty())?;
1710-
let size = layout.size(&ecx.tcx.data_layout).bytes();
1711-
let align = layout.align(&ecx.tcx.data_layout).abi();
1712-
ecx.memory.allocate(size, align)?
1713-
};
1707+
let ret_ptr = ecx.memory.allocate(ecx.tcx.data_layout.pointer_size.bytes(), ecx.tcx.data_layout.pointer_align.abi())?;
17141708
cleanup_ptr = Some(ret_ptr);
17151709

17161710
// Push our stack frame

0 commit comments

Comments
 (0)