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:
parent
5445715c20
commit
2b60338ee9
8 changed files with 18 additions and 25 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue