Make DefPathHash->DefId panic for if the mapping fails.
We only use this mapping for cases where we know that it must succeed. Letting it panic otherwise makes it harder to use the API in unsupported ways.
This commit is contained in:
@@ -443,12 +443,13 @@ impl Definitions {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn local_def_path_hash_to_def_id(&self, hash: DefPathHash) -> Option<LocalDefId> {
|
||||
pub fn local_def_path_hash_to_def_id(&self, hash: DefPathHash) -> 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()
|
||||
}
|
||||
|
||||
pub fn def_path_hash_to_def_index_map(&self) -> &DefPathHashMap {
|
||||
|
||||
Reference in New Issue
Block a user