Remove EarlyErrorHandler argument from after_analysis callback

It is only used by miri which can create a new one using the Session.
This commit is contained in:
bjorn3 2023-09-10 09:44:03 +00:00
parent 90e9053189
commit 2eca717a24
4 changed files with 4 additions and 8 deletions

View File

@ -185,7 +185,6 @@ pub trait Callbacks {
/// continue the compilation afterwards (defaults to `Compilation::Continue`)
fn after_analysis<'tcx>(
&mut self,
_handler: &EarlyErrorHandler,
_compiler: &interface::Compiler,
_queries: &'tcx Queries<'tcx>,
) -> Compilation {
@ -446,7 +445,7 @@ fn run_compiler(
queries.global_ctxt()?.enter(|tcx| tcx.analysis(()))?;
if callbacks.after_analysis(&handler, compiler, queries) == Compilation::Stop {
if callbacks.after_analysis(compiler, queries) == Compilation::Stop {
return early_exit();
}

View File

@ -16,7 +16,6 @@ use rustc_driver::{Callbacks, Compilation, RunCompiler};
use rustc_interface::{interface, Queries};
use rustc_middle::mir::interpret::AllocId;
use rustc_middle::ty::TyCtxt;
use rustc_session::EarlyErrorHandler;
pub use rustc_span::def_id::{CrateNum, DefId};
fn with_tables<R>(mut f: impl FnMut(&mut Tables<'_>) -> R) -> R {
@ -233,7 +232,6 @@ where
/// continue the compilation afterwards (defaults to `Compilation::Continue`)
fn after_analysis<'tcx>(
&mut self,
_handler: &EarlyErrorHandler,
_compiler: &interface::Compiler,
queries: &'tcx Queries<'tcx>,
) -> Compilation {

View File

@ -59,7 +59,6 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
fn after_analysis<'tcx>(
&mut self,
handler: &EarlyErrorHandler,
_: &rustc_interface::interface::Compiler,
queries: &'tcx rustc_interface::Queries<'tcx>,
) -> Compilation {
@ -68,7 +67,8 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
tcx.sess.fatal("miri cannot be run on programs that fail compilation");
}
init_late_loggers(handler, tcx);
let handler = EarlyErrorHandler::new(tcx.sess.opts.error_format);
init_late_loggers(&handler, tcx);
if !tcx.crate_types().contains(&CrateType::Executable) {
tcx.sess.fatal("miri only makes sense on bin crates");
}

View File

@ -27,7 +27,7 @@ use rustc_interface::{Config, Queries};
use rustc_middle::query::queries::mir_borrowck::ProvidedValue;
use rustc_middle::query::{ExternProviders, Providers};
use rustc_middle::ty::TyCtxt;
use rustc_session::{Session, EarlyErrorHandler};
use rustc_session::Session;
use std::cell::RefCell;
use std::collections::HashMap;
use std::thread_local;
@ -58,7 +58,6 @@ impl rustc_driver::Callbacks for CompilerCalls {
// the result.
fn after_analysis<'tcx>(
&mut self,
_handler: &EarlyErrorHandler,
compiler: &Compiler,
queries: &'tcx Queries<'tcx>,
) -> Compilation {