This commit is contained in:
Edgar 2024-03-12 12:08:02 +01:00
parent edb872a218
commit a70924b81b
No known key found for this signature in database
GPG key ID: 70ADAE8F35904387

View file

@ -992,15 +992,15 @@ fn compile_rvalue<'ctx>(
for proj in &place.projection { for proj in &place.projection {
match proj { match proj {
ir::PlaceElem::Deref => { ir::PlaceElem::Deref => {
ptr = ctx
.builder
.build_load(compile_basic_type(ctx, &local_ty), ptr, "deref")?
.into_pointer_value();
local_ty = match local_ty.kind { local_ty = match local_ty.kind {
ir::TypeKind::Ptr(_, inner) => *inner, ir::TypeKind::Ptr(_, inner) => *inner,
ir::TypeKind::Ref(_, inner) => *inner, ir::TypeKind::Ref(_, inner) => *inner,
_ => unreachable!(), _ => unreachable!(),
} };
ptr = ctx
.builder
.build_load(compile_basic_type(ctx, &local_ty), ptr, "deref")?
.into_pointer_value();
} }
ir::PlaceElem::Field { .. } => todo!(), ir::PlaceElem::Field { .. } => todo!(),
ir::PlaceElem::Index { .. } => todo!(), ir::PlaceElem::Index { .. } => todo!(),