diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-03-26 12:31:41 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-03-27 08:20:06 +0000 |
| commit | 0f5911c62647601cbe6c81e935615a770e7fc3ff (patch) | |
| tree | 5d81c8fdd91c74508104227a38462fc415b44a08 /compiler/rustc_metadata/src | |
| parent | 32bd3c30d8d4d5909b9bafd4c7b554f46b58d9ab (diff) | |
| download | rust-0f5911c62647601cbe6c81e935615a770e7fc3ff.tar.gz rust-0f5911c62647601cbe6c81e935615a770e7fc3ff.zip | |
Move `CrateStore::expn_hash_to_expn_id` to a hook
Diffstat (limited to 'compiler/rustc_metadata/src')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index 187364d8b44..1720a4642c5 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -21,7 +21,7 @@ use rustc_middle::ty::{self, TyCtxt}; use rustc_middle::util::Providers; use rustc_session::cstore::{CrateStore, ExternCrate}; use rustc_session::{Session, StableCrateId}; -use rustc_span::hygiene::{ExpnHash, ExpnId}; +use rustc_span::hygiene::ExpnId; use rustc_span::symbol::{kw, Symbol}; use rustc_span::Span; @@ -655,19 +655,13 @@ impl CrateStore for CStore { let def_index = self.get_crate_data(cnum).def_path_hash_to_def_index(hash); DefId { krate: cnum, index: def_index } } - - fn expn_hash_to_expn_id( - &self, - sess: &Session, - cnum: CrateNum, - index_guess: u32, - hash: ExpnHash, - ) -> ExpnId { - self.get_crate_data(cnum).expn_hash_to_expn_id(sess, index_guess, hash) - } } fn provide_cstore_hooks(providers: &mut Providers) { + providers.hooks.expn_hash_to_expn_id = |tcx, cnum, index_guess, hash| { + let cstore = CStore::from_tcx(tcx.tcx); + cstore.get_crate_data(cnum).expn_hash_to_expn_id(tcx.sess, index_guess, hash) + }; providers.hooks.import_source_files = |tcx, cnum| { let cstore = CStore::from_tcx(tcx.tcx); let cdata = cstore.get_crate_data(cnum); |
