From 70d36a05bc79667578a3c7b2b4926e21a9a5d013 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Wed, 19 Jan 2022 17:36:44 -0500 Subject: Show a more informative panic message when `DefPathHash` does not exist This should hopefully make it easier to debug incremental compilation bugs like #93096 without affecting performance. --- compiler/rustc_query_impl/src/on_disk_cache.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_query_impl/src/on_disk_cache.rs') diff --git a/compiler/rustc_query_impl/src/on_disk_cache.rs b/compiler/rustc_query_impl/src/on_disk_cache.rs index 6a88e123537..5f6d9b050b2 100644 --- a/compiler/rustc_query_impl/src/on_disk_cache.rs +++ b/compiler/rustc_query_impl/src/on_disk_cache.rs @@ -761,7 +761,9 @@ impl<'a, 'tcx> Decodable> for DefId { // If we get to this point, then all of the query inputs were green, // which means that the definition with this hash is guaranteed to // still exist in the current compilation session. - Ok(d.tcx().def_path_hash_to_def_id(def_path_hash)) + Ok(d.tcx().def_path_hash_to_def_id(def_path_hash, &mut || { + panic!("Failed to convert DefPathHash {:?}", def_path_hash) + })) } } -- cgit 1.4.1-3-g733a5