[core] Improve assert failure message for id epoch mismatches. (#7871)

This commit is contained in:
Jim Blandy 2025-07-02 00:33:55 -07:00 committed by GitHub
parent 92cda27b41
commit 2f890eb9b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,7 @@ where
let (index, epoch) = id.unzip(); let (index, epoch) = id.unzip();
match mem::replace(&mut self.map[index as usize], Element::Vacant) { match mem::replace(&mut self.map[index as usize], Element::Vacant) {
Element::Occupied(value, storage_epoch) => { Element::Occupied(value, storage_epoch) => {
assert_eq!(epoch, storage_epoch); assert_eq!(epoch, storage_epoch, "id epoch mismatch");
value value
} }
Element::Vacant => panic!("Cannot remove a vacant resource"), Element::Vacant => panic!("Cannot remove a vacant resource"),