Remove prepare_outputs

This commit is contained in:
Oli Scherer 2022-12-06 15:07:00 +00:00
parent 41edaac716
commit 9e9c871a78
2 changed files with 11 additions and 23 deletions

View File

@ -362,7 +362,7 @@ fn run_compiler(
return early_exit(); return early_exit();
} }
queries.prepare_outputs()?; queries.global_ctxt()?;
if sess.opts.output_types.contains_key(&OutputType::DepInfo) if sess.opts.output_types.contains_key(&OutputType::DepInfo)
&& sess.opts.output_types.len() == 1 && sess.opts.output_types.len() == 1
@ -370,8 +370,6 @@ fn run_compiler(
return early_exit(); return early_exit();
} }
queries.global_ctxt()?;
if sess.opts.unstable_opts.no_analysis { if sess.opts.unstable_opts.no_analysis {
return early_exit(); return early_exit();
} }

View File

@ -90,7 +90,6 @@ pub struct Queries<'tcx> {
register_plugins: Query<(ast::Crate, Lrc<LintStore>)>, register_plugins: Query<(ast::Crate, Lrc<LintStore>)>,
expansion: Query<(Lrc<ast::Crate>, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>, expansion: Query<(Lrc<ast::Crate>, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>,
dep_graph: Query<DepGraph>, dep_graph: Query<DepGraph>,
prepare_outputs: Query<OutputFilenames>,
global_ctxt: Query<QueryContext<'tcx>>, global_ctxt: Query<QueryContext<'tcx>>,
ongoing_codegen: Query<Box<dyn Any>>, ongoing_codegen: Query<Box<dyn Any>>,
} }
@ -109,7 +108,6 @@ impl<'tcx> Queries<'tcx> {
register_plugins: Default::default(), register_plugins: Default::default(),
expansion: Default::default(), expansion: Default::default(),
dep_graph: Default::default(), dep_graph: Default::default(),
prepare_outputs: Default::default(),
global_ctxt: Default::default(), global_ctxt: Default::default(),
ongoing_codegen: Default::default(), ongoing_codegen: Default::default(),
} }
@ -211,32 +209,24 @@ impl<'tcx> Queries<'tcx> {
}) })
} }
pub fn prepare_outputs(&self) -> Result<QueryResult<'_, OutputFilenames>> {
self.prepare_outputs.compute(|| {
let expansion = self.expansion()?;
let (krate, boxed_resolver, _) = &*expansion.borrow();
let crate_name = *self.crate_name()?.borrow();
passes::prepare_outputs(
self.session(),
self.compiler,
krate,
&*boxed_resolver,
crate_name,
)
})
}
pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, QueryContext<'tcx>>> { pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, QueryContext<'tcx>>> {
self.global_ctxt.compute(|| { self.global_ctxt.compute(|| {
let crate_name = *self.crate_name()?.borrow(); let crate_name = *self.crate_name()?.borrow();
let outputs = self.prepare_outputs()?.steal();
let dep_graph = self.dep_graph()?.borrow().clone();
let (krate, resolver, lint_store) = self.expansion()?.steal(); let (krate, resolver, lint_store) = self.expansion()?.steal();
let outputs = passes::prepare_outputs(
self.session(),
self.compiler,
&krate,
&resolver,
crate_name,
)?;
Ok(passes::create_global_ctxt( Ok(passes::create_global_ctxt(
self.compiler, self.compiler,
lint_store, lint_store,
krate, krate,
dep_graph, self.dep_graph()?.steal(),
resolver, resolver,
outputs, outputs,
crate_name, crate_name,