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.
This commit is contained in:
Aaron Hill 2022-01-19 17:36:44 -05:00
parent 5e57faa78a
commit 70d36a05bc
No known key found for this signature in database
GPG key ID: B4087E510E98B164
4 changed files with 17 additions and 6 deletions

View file

@ -761,7 +761,9 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> 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)
}))
}
}