about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-04-04 09:46:53 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-04-04 09:46:53 +0000
commit0dca136841191074e1703ae9eccc8b15aadb643f (patch)
tree48cd6ca7d722f6ba3fe4fda2ec3ab58022f4657d
parent2d4b7f287d641b01d666416892498de6b6d7c23c (diff)
downloadrust-0dca136841191074e1703ae9eccc8b15aadb643f.tar.gz
rust-0dca136841191074e1703ae9eccc8b15aadb643f.zip
Try explicitly outlining the panic machinery
-rw-r--r--compiler/rustc_hir/src/definitions.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs
index ce910f13101..cd5da279a26 100644
--- a/compiler/rustc_hir/src/definitions.rs
+++ b/compiler/rustc_hir/src/definitions.rs
@@ -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 {