From 3d27abc5d372761bcb5334eaa37296a9d3a3fe3a Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 21 Sep 2023 15:53:29 +0200 Subject: [PATCH] Use opaque reference --- crates/ir/src/insn.rs | 2 +- crates/ir/src/module.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ir/src/insn.rs b/crates/ir/src/insn.rs index 9635bb1d..5aa8e769 100644 --- a/crates/ir/src/insn.rs +++ b/crates/ir/src/insn.rs @@ -468,7 +468,7 @@ impl<'a> fmt::Display for DisplayInsnData<'a> { Call { args, func: callee, .. } => { - let callee = DisplayCalleeFuncRef::new(callee, func); + let callee = DisplayCalleeFuncRef::new(*callee, func); write!(f, "call %{callee} ")?; display_arg_values(f, args, dfg)?; ";".fmt(f) diff --git a/crates/ir/src/module.rs b/crates/ir/src/module.rs index c9bef630..5e68d721 100644 --- a/crates/ir/src/module.rs +++ b/crates/ir/src/module.rs @@ -91,12 +91,12 @@ pub struct FuncRef(u32); entity_impl!(FuncRef); pub struct DisplayCalleeFuncRef<'a> { - callee: &'a FuncRef, + callee: FuncRef, func: &'a Function, } impl<'a> DisplayCalleeFuncRef<'a> { - pub fn new(callee: &'a FuncRef, func: &'a Function) -> Self { + pub fn new(callee: FuncRef, func: &'a Function) -> Self { Self { callee, func } } } @@ -104,7 +104,7 @@ impl<'a> DisplayCalleeFuncRef<'a> { impl<'a> fmt::Display for DisplayCalleeFuncRef<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { callee, func } = *self; - let sig = func.callees.get(callee).unwrap(); + let sig = func.callees.get(&callee).unwrap(); write!(f, "{}", sig.name()) } }