Skip to content

Commit

Permalink
Try explicitly outlining the panic machinery
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Apr 4, 2024
1 parent 2d4b7f2 commit 0dca136
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/rustc_hir/src/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,16 @@ impl Definitions {
err_msg: &dyn std::fmt::Debug,
) -> LocalDefId {
debug_assert!(hash.stable_crate_id() == self.table.stable_crate_id);
#[cold]
#[inline(never)]
fn err(err_msg: &dyn std::fmt::Debug) -> ! {
panic!("{err_msg:?}")
}
self.table
.def_path_hash_to_index
.get(&hash.local_hash())
.map(|local_def_index| LocalDefId { local_def_index })
.unwrap_or_else(|| panic!("{err_msg:?}"))
.unwrap_or_else(|| err(err_msg))
}

pub fn def_path_hash_to_def_index_map(&self) -> &DefPathHashMap {
Expand Down

0 comments on commit 0dca136

Please sign in to comment.