From 9ee3138da0d275573ab4d171a8ec71eaca37142f Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 21 Jan 2024 22:22:44 +0800 Subject: [PATCH] HIR Expand Reborrow - Fix usage annotations for `*foo` into `&mut **foo` --- src/hir_expand/reborrow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hir_expand/reborrow.cpp b/src/hir_expand/reborrow.cpp index 2e8be9ad..ee584fe4 100644 --- a/src/hir_expand/reborrow.cpp +++ b/src/hir_expand/reborrow.cpp @@ -64,6 +64,9 @@ namespace { || dynamic_cast< ::HIR::ExprNode_Deref*>(node_ptr.get()) ) { + if( auto* inner = dynamic_cast< ::HIR::ExprNode_Deref*>(node_ptr.get()) ) { + inner->m_value->m_usage = HIR::ValueUsage::Mutate; + } DEBUG("Insert reborrow - " << node_ptr->span() << " - type=" << node_ptr->m_res_type); auto sp = node_ptr->span(); auto ty_mut = node_ptr->m_res_type.clone();