diff options
| author | bors <bors@rust-lang.org> | 2023-12-18 02:06:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-18 02:06:02 +0000 |
| commit | 321b6565a5f8ebf6f23622fc91ea1191a54f2a38 (patch) | |
| tree | 872ba25fd81f077921ca86c3b5371856c81ccdc9 /compiler/rustc_middle/src | |
| parent | 43dcc9b786c922251c3fbe75a0142f50f07053ca (diff) | |
| parent | be321aa473433e5192b02099531020914f42c5da (diff) | |
| download | rust-321b6565a5f8ebf6f23622fc91ea1191a54f2a38.tar.gz rust-321b6565a5f8ebf6f23622fc91ea1191a54f2a38.zip | |
Auto merge of #118657 - petrochenkov:feedvis, r=cjgillot
resolve: Replace visibility table in resolver outputs with query feeding Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily. I suspect that in general this approach should work for queries that are 1) executed for most keys and 2) have results that are cheap to hash (do not have spans, in particular). Visibility query matches that description.
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/hir/map/mod.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 598c26de23f..81f34c7b8b0 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -1142,7 +1142,10 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, _: LocalCrate) -> Svh { tcx.sess.opts.dep_tracking_hash(true).hash_stable(&mut hcx, &mut stable_hasher); tcx.stable_crate_id(LOCAL_CRATE).hash_stable(&mut hcx, &mut stable_hasher); // Hash visibility information since it does not appear in HIR. - resolutions.visibilities.hash_stable(&mut hcx, &mut stable_hasher); + // FIXME: Figure out how to remove `visibilities_for_hashing` by hashing visibilities on + // the fly in the resolver, storing only their accumulated hash in `ResolverGlobalCtxt`, + // and combining it with other hashes here. + resolutions.visibilities_for_hashing.hash_stable(&mut hcx, &mut stable_hasher); stable_hasher.finish() }); diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index febab23ea35..6513bf501e1 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -152,7 +152,7 @@ pub struct ResolverOutputs { #[derive(Debug)] pub struct ResolverGlobalCtxt { - pub visibilities: FxHashMap<LocalDefId, Visibility>, + pub visibilities_for_hashing: Vec<(LocalDefId, Visibility)>, /// Item with a given `LocalDefId` was defined during macro expansion with ID `ExpnId`. pub expn_that_defined: FxHashMap<LocalDefId, ExpnId>, pub effective_visibilities: EffectiveVisibilities, |
