1
Fork 0

Show a more informative panic message when DefPathHash does not exist

This should hopefully make it easier to debug incremental compilation
bugs like #93096 without affecting performance.
This commit is contained in:
Aaron Hill 2022-01-19 17:36:44 -05:00
parent 5e57faa78a
commit 70d36a05bc
No known key found for this signature in database
GPG key ID: B4087E510E98B164
4 changed files with 17 additions and 6 deletions

View file

@ -449,13 +449,17 @@ impl Definitions {
}
#[inline(always)]
pub fn local_def_path_hash_to_def_id(&self, hash: DefPathHash) -> LocalDefId {
pub fn local_def_path_hash_to_def_id(
&self,
hash: DefPathHash,
err: &mut dyn FnMut() -> !,
) -> LocalDefId {
debug_assert!(hash.stable_crate_id() == self.stable_crate_id);
self.table
.def_path_hash_to_index
.get(&hash)
.map(|local_def_index| LocalDefId { local_def_index })
.unwrap()
.unwrap_or_else(|| err())
}
pub fn def_path_hash_to_def_index_map(&self) -> &DefPathHashMap {