diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-10-16 17:13:02 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-10-20 18:28:54 +0200 |
| commit | e53404cca68e8220a57339cb3e213fd0d8e99a5f (patch) | |
| tree | f19b80c291d68a65293756c141cc3ae23115829c /compiler/rustc_query_impl | |
| parent | 88c6d3de95cee8525b40adbb49446f89ad339e4d (diff) | |
| download | rust-e53404cca68e8220a57339cb3e213fd0d8e99a5f.tar.gz rust-e53404cca68e8220a57339cb3e213fd0d8e99a5f.zip | |
Move def_path_hash_to_def_id to rustc_middle.
Diffstat (limited to 'compiler/rustc_query_impl')
| -rw-r--r-- | compiler/rustc_query_impl/src/on_disk_cache.rs | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/compiler/rustc_query_impl/src/on_disk_cache.rs b/compiler/rustc_query_impl/src/on_disk_cache.rs index 48eb488792d..499dae650b3 100644 --- a/compiler/rustc_query_impl/src/on_disk_cache.rs +++ b/compiler/rustc_query_impl/src/on_disk_cache.rs @@ -358,23 +358,6 @@ impl<'sess> rustc_middle::ty::OnDiskCache<'sess> for OnDiskCache<'sess> { Ok(()) }) } - - fn def_path_hash_to_def_id(&self, tcx: TyCtxt<'tcx>, hash: DefPathHash) -> DefId { - debug!("def_path_hash_to_def_id({:?})", hash); - - let stable_crate_id = hash.stable_crate_id(); - - // If this is a DefPathHash from the local crate, we can look up the - // DefId in the tcx's `Definitions`. - if stable_crate_id == tcx.sess.local_stable_crate_id() { - tcx.definitions_untracked().local_def_path_hash_to_def_id(hash).to_def_id() - } else { - // If this is a DefPathHash from an upstream crate, let the CrateStore map - // it to a DefId. - let cnum = tcx.cstore_untracked().stable_crate_id_to_crate_num(stable_crate_id); - tcx.cstore_untracked().def_path_hash_to_def_id(cnum, hash) - } - } } impl<'sess> OnDiskCache<'sess> { @@ -764,7 +747,7 @@ 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().on_disk_cache.as_ref().unwrap().def_path_hash_to_def_id(d.tcx(), def_path_hash)) + Ok(d.tcx().def_path_hash_to_def_id(def_path_hash)) } } |
