Skip to content

Commit 0dca136

Browse files
committed
Try explicitly outlining the panic machinery
1 parent 2d4b7f2 commit 0dca136

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: compiler/rustc_hir/src/definitions.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,16 @@ impl Definitions {
383383
err_msg: &dyn std::fmt::Debug,
384384
) -> LocalDefId {
385385
debug_assert!(hash.stable_crate_id() == self.table.stable_crate_id);
386+
#[cold]
387+
#[inline(never)]
388+
fn err(err_msg: &dyn std::fmt::Debug) -> ! {
389+
panic!("{err_msg:?}")
390+
}
386391
self.table
387392
.def_path_hash_to_index
388393
.get(&hash.local_hash())
389394
.map(|local_def_index| LocalDefId { local_def_index })
390-
.unwrap_or_else(|| panic!("{err_msg:?}"))
395+
.unwrap_or_else(|| err(err_msg))
391396
}
392397

393398
pub fn def_path_hash_to_def_index_map(&self) -> &DefPathHashMap {

0 commit comments

Comments
 (0)