From 6664b25932feb9ff71f8bec23fdb3c3b1e76e328 Mon Sep 17 00:00:00 2001 From: sofia Date: Thu, 24 Jul 2025 01:51:44 +0300 Subject: [PATCH] Fix deref expecting a codegenptr and not borrow --- examples/ptr_hard.reid | 3 ++- reid/src/codegen.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/ptr_hard.reid b/examples/ptr_hard.reid index 5f1d9d2..a83b06c 100644 --- a/examples/ptr_hard.reid +++ b/examples/ptr_hard.reid @@ -1,6 +1,7 @@ -fn main() { +fn main() -> u8 { let mut a = 5; inner(&mut a); + return 0; } fn inner(a: &mut i32) { diff --git a/reid/src/codegen.rs b/reid/src/codegen.rs index 421f2ab..ccd3ec7 100644 --- a/reid/src/codegen.rs +++ b/reid/src/codegen.rs @@ -1179,7 +1179,7 @@ impl mir::Expression { Some({ if state.should_load { - if let TypeKind::CodegenPtr(inner) = *ptr_inner.clone() { + if let TypeKind::Borrow(inner, _) = *ptr_inner.clone() { StackValue( v.0.derive( scope