From ce5ca4a93cc4c7f5065a137a0b615e38355aa7f8 Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Tue, 15 Nov 2022 14:24:07 -0600 Subject: [PATCH] Mark emplace_variable as must_use --- crates/compiler/types/src/types.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/compiler/types/src/types.rs b/crates/compiler/types/src/types.rs index 337eb08f85..e7dfa72a3e 100644 --- a/crates/compiler/types/src/types.rs +++ b/crates/compiler/types/src/types.rs @@ -585,8 +585,9 @@ impl Types { /// # Safety /// /// May only be called if `var` is known to represent the type at `index`. - pub unsafe fn emplace_variable(&mut self, index: Index, var: Variable) { - self.tags[index.index()] = TypeTag::Variable(var); + #[must_use] + pub unsafe fn emplace_variable(&mut self, index: Index, var: Variable) -> TypeTag { + std::mem::replace(&mut self.tags[index.index()], TypeTag::Variable(var)) } fn reserve_type_tags(&mut self, length: usize) -> Slice {