feed resolver_for_lowering instead of storing it in a field

This commit is contained in:
Oli Scherer 2022-12-03 18:06:39 +00:00
parent 125b729ddd
commit f693b7848e
8 changed files with 50 additions and 26 deletions

View file

@ -12,6 +12,7 @@ use rustc_ast::{self as ast, visit};
use rustc_borrowck as mir_borrowck;
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_data_structures::parallel;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::sync::{Lrc, OnceCell, WorkerLocal};
use rustc_errors::{ErrorGuaranteed, PResult};
use rustc_expand::base::{ExtCtxt, LintStoreExpand, ResolverExpand};
@ -804,6 +805,12 @@ pub fn create_global_ctxt<'tcx>(
TcxQueries::new(local_providers, extern_providers, query_result_on_disk_cache)
});
let ty::ResolverOutputs {
definitions,
global_ctxt: untracked_resolutions,
ast_lowering: untracked_resolver_for_lowering,
} = resolver_outputs;
let gcx = sess.time("setup_global_ctxt", || {
global_ctxt.get_or_init(move || {
TyCtxt::create_global_ctxt(
@ -811,7 +818,8 @@ pub fn create_global_ctxt<'tcx>(
lint_store,
arena,
hir_arena,
resolver_outputs,
definitions,
untracked_resolutions,
krate,
dep_graph,
queries.on_disk_cache.as_ref().map(OnDiskCache::as_dyn),
@ -823,7 +831,12 @@ pub fn create_global_ctxt<'tcx>(
})
});
QueryContext { gcx }
let mut qcx = QueryContext { gcx };
qcx.enter(|tcx| {
tcx.feed_unit_query()
.resolver_for_lowering(tcx.arena.alloc(Steal::new(untracked_resolver_for_lowering)))
});
qcx
}
/// Runs the resolution, type-checking, region checking and other