Mark emplace_variable as must_use

This commit is contained in:
Ayaz Hafiz 2022-11-15 14:24:07 -06:00
parent 33a9c39cfd
commit ce5ca4a93c
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58

View File

@ -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<TypeTag>, var: Variable) {
self.tags[index.index()] = TypeTag::Variable(var);
#[must_use]
pub unsafe fn emplace_variable(&mut self, index: Index<TypeTag>, var: Variable) -> TypeTag {
std::mem::replace(&mut self.tags[index.index()], TypeTag::Variable(var))
}
fn reserve_type_tags(&mut self, length: usize) -> Slice<TypeTag> {