Feed resolutions query instead of it being a thin wrapper around an untracked field

This commit is contained in:
Oli Scherer 2022-12-05 16:19:14 +00:00
parent 222d1ff68d
commit 408ae0fcb9
4 changed files with 6 additions and 9 deletions

View File

@ -817,7 +817,6 @@ pub fn create_global_ctxt<'tcx>(
lint_store,
arena,
hir_arena,
untracked_resolutions,
untracked,
krate,
dep_graph,
@ -832,8 +831,9 @@ pub fn create_global_ctxt<'tcx>(
let mut qcx = QueryContext { gcx };
qcx.enter(|tcx| {
tcx.feed_unit_query()
.resolver_for_lowering(tcx.arena.alloc(Steal::new(untracked_resolver_for_lowering)))
let feed = tcx.feed_unit_query();
feed.resolver_for_lowering(tcx.arena.alloc(Steal::new(untracked_resolver_for_lowering)));
feed.resolutions(tcx.arena.alloc(untracked_resolutions));
});
qcx
}

View File

@ -31,6 +31,7 @@ macro_rules! arena_types {
[decode] borrowck_result:
rustc_middle::mir::BorrowCheckResult<'tcx>,
[] resolver: rustc_data_structures::steal::Steal<rustc_middle::ty::ResolverAstLowering>,
[] resolutions: rustc_middle::ty::ResolverGlobalCtxt,
[decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
[decode] code_region: rustc_middle::mir::coverage::CodeRegion,
[] const_allocs: rustc_middle::mir::interpret::Allocation,

View File

@ -27,7 +27,7 @@ rustc_queries! {
}
query resolutions(_: ()) -> &'tcx ty::ResolverGlobalCtxt {
eval_always
feedable
no_hash
desc { "getting the resolver outputs" }
}

View File

@ -428,8 +428,7 @@ pub struct GlobalCtxt<'tcx> {
pub consts: CommonConsts<'tcx>,
untracked: Untracked,
/// Output of the resolver.
pub(crate) untracked_resolutions: ty::ResolverGlobalCtxt,
/// The entire crate as AST. This field serves as the input for the hir_crate query,
/// which lowers it from AST to HIR. It must not be read or used by anything else.
pub untracked_crate: Steal<Lrc<ast::Crate>>,
@ -592,7 +591,6 @@ impl<'tcx> TyCtxt<'tcx> {
lint_store: Lrc<dyn Any + sync::Send + sync::Sync>,
arena: &'tcx WorkerLocal<Arena<'tcx>>,
hir_arena: &'tcx WorkerLocal<hir::Arena<'tcx>>,
untracked_resolutions: ty::ResolverGlobalCtxt,
untracked: Untracked,
krate: Lrc<ast::Crate>,
dep_graph: DepGraph,
@ -622,7 +620,6 @@ impl<'tcx> TyCtxt<'tcx> {
lifetimes: common_lifetimes,
consts: common_consts,
untracked,
untracked_resolutions,
untracked_crate: Steal::new(krate),
on_disk_cache,
queries,
@ -2407,7 +2404,6 @@ fn ptr_eq<T, U>(t: *const T, u: *const U) -> bool {
}
pub fn provide(providers: &mut ty::query::Providers) {
providers.resolutions = |tcx, ()| &tcx.untracked_resolutions;
providers.module_reexports =
|tcx, id| tcx.resolutions(()).reexport_map.get(&id).map(|v| &v[..]);
providers.crate_name = |tcx, id| {