1
Fork 0

Pass TyCtxt instead of Queries to the after_analysis callbacks

There is no other query that may need to be called at that point anyway.
This commit is contained in:
bjorn3 2024-10-31 16:05:59 +00:00
parent 1eece7478d
commit 3b02a3309e
22 changed files with 112 additions and 107 deletions

View file

@ -50,6 +50,7 @@ use rustc_interface::{Linker, Queries, interface, passes};
use rustc_lint::unerased_lint_store;
use rustc_metadata::creader::MetadataLoader;
use rustc_metadata::locator;
use rustc_middle::ty::TyCtxt;
use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal};
use rustc_session::config::{
CG_OPTIONS, ErrorOutputType, Input, OutFileName, OutputType, UnstableOptions, Z_OPTIONS,
@ -179,7 +180,7 @@ pub trait Callbacks {
fn after_analysis<'tcx>(
&mut self,
_compiler: &interface::Compiler,
_queries: &'tcx Queries<'tcx>,
_tcx: TyCtxt<'tcx>,
) -> Compilation {
Compilation::Continue
}
@ -437,13 +438,11 @@ fn run_compiler(
}
tcx.analysis(())?;
})?;
if callbacks.after_analysis(compiler, queries) == Compilation::Stop {
return early_exit();
}
if callbacks.after_analysis(compiler, tcx) == Compilation::Stop {
return early_exit();
}
queries.global_ctxt()?.enter(|tcx| {
Ok(Some(Linker::codegen_and_build_linker(tcx, &*compiler.codegen_backend)?))
})
})?;