consistently treat None-tagged pointers as ints; get rid of some deprecated Scalar methods

This commit is contained in:
Ralf Jung 2021-07-12 20:29:05 +02:00
parent d4f7dd6702
commit 626605cea0
29 changed files with 145 additions and 139 deletions

View file

@ -139,6 +139,7 @@ pub(super) fn op_to_const<'tcx>(
op.try_as_mplace()
};
// We know `offset` is relative to the allocation, so we can use `into_parts`.
let to_const_value = |mplace: &MPlaceTy<'_>| match mplace.ptr.into_parts() {
(Some(alloc_id), offset) => {
let alloc = ecx.tcx.global_alloc(alloc_id).unwrap_memory();
@ -164,6 +165,7 @@ pub(super) fn op_to_const<'tcx>(
ScalarMaybeUninit::Uninit => to_const_value(&op.assert_mem_place()),
},
Immediate::ScalarPair(a, b) => {
// We know `offset` is relative to the allocation, so we can use `into_parts`.
let (data, start) = match ecx.scalar_to_ptr(a.check_init().unwrap()).into_parts() {
(Some(alloc_id), offset) => {
(ecx.tcx.global_alloc(alloc_id).unwrap_memory(), offset.bytes())