diff options
| author | Michael Baikov <manpacket@gmail.com> | 2024-06-13 08:46:30 -0400 |
|---|---|---|
| committer | Michael Baikov <manpacket@gmail.com> | 2024-06-19 07:45:47 -0400 |
| commit | 12f8d12b418c9bbe4d2142f2c8e00a28a5b6dfe5 (patch) | |
| tree | f7e40e3bd184af1f179857a087c83ed130091f4f /compiler/rustc_middle/src/query | |
| parent | db5ed4bd799cda1217ec6431ffa56cecd09ef6e9 (diff) | |
| download | rust-12f8d12b418c9bbe4d2142f2c8e00a28a5b6dfe5.tar.gz rust-12f8d12b418c9bbe4d2142f2c8e00a28a5b6dfe5.zip | |
local_def_path_hash_to_def_id can fail
local_def_path_hash_to_def_id is used by Debug impl for DepNode and it looks for DefPathHash inside the current compilation. During incremental compilation we are going through nodes that belong to a previous compilation and might not be present and a simple attempt to print such node with tracing::debug (try_mark_parent_green does it for example) results in a otherwise avoidable panic Panic was added in https://github.com/rust-lang/rust/pull/82183, specifically in 2b60338ee9, with a comment "We only use this mapping for cases where we know that it must succeed.", but I'm not sure if this property holds when we traverse nodes from the old compilation in order to figure out if they are valid or not
Diffstat (limited to 'compiler/rustc_middle/src/query')
| -rw-r--r-- | compiler/rustc_middle/src/query/on_disk_cache.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/query/on_disk_cache.rs b/compiler/rustc_middle/src/query/on_disk_cache.rs index ccd0c7cb10c..924249bf37d 100644 --- a/compiler/rustc_middle/src/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/query/on_disk_cache.rs @@ -733,10 +733,10 @@ impl<'a, 'tcx> SpanDecoder for CacheDecoder<'a, 'tcx> { // 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. - self.tcx.def_path_hash_to_def_id( - def_path_hash, - &("Failed to convert DefPathHash", def_path_hash), - ) + match self.tcx.def_path_hash_to_def_id(def_path_hash) { + Some(r) => r, + None => panic!("Failed to convert DefPathHash {def_path_hash:?}"), + } } fn decode_attr_id(&mut self) -> rustc_span::AttrId { |
