This commit is contained in:
bjorn3
2021-10-10 15:26:43 +02:00
parent 355dd996a2
commit 80709ab624

View File

@@ -219,10 +219,9 @@ impl ConstantPool {
/// replacing any existing constant values. use `set` to tie a specific `const42` to its value; /// replacing any existing constant values. use `set` to tie a specific `const42` to its value;
/// use `insert` to add a value and return the next available `const` entity. /// use `insert` to add a value and return the next available `const` entity.
pub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData) { pub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData) {
let replaced = self.handles_to_values.insert( let replaced = self
constant_handle, .handles_to_values
constant_value.clone(), .insert(constant_handle, constant_value.clone());
);
assert!( assert!(
replaced.is_none(), replaced.is_none(),
"attempted to overwrite an existing constant {:?}: {:?} => {:?}", "attempted to overwrite an existing constant {:?}: {:?} => {:?}",