use deref on ImmTy

This commit is contained in:
b-naber 2022-04-08 17:13:45 +02:00
parent 82217a6587
commit 8a5273bc99
2 changed files with 3 additions and 4 deletions

View File

@ -121,11 +121,10 @@ fn const_to_valtree_inner<'tcx>(
ty::Slice(_) | ty::Str => {
match ecx.try_read_immediate_from_mplace(&place) {
Ok(Some(imm)) => {
let mplace_ref = ecx.ref_to_mplace(&imm).unwrap();
let derefd = ecx.deref_operand(&place.into()).expect(&format!("couldnt deref {:?}", imm));
debug!(?mplace_ref, ?derefd);
debug!(?derefd);
let len = match imm.imm {
let len = match *imm {
Immediate::ScalarPair(_, b) => {
let len = b.to_machine_usize(&ecx.tcx.tcx).unwrap();
len

View File

@ -98,7 +98,7 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
// as input for binary and cast operations.
#[derive(Copy, Clone, Debug)]
pub struct ImmTy<'tcx, Tag: Provenance = AllocId> {
pub(crate) imm: Immediate<Tag>,
imm: Immediate<Tag>,
pub layout: TyAndLayout<'tcx>,
}