@@ -35,7 +35,7 @@ use rustc_middle::{
35
35
} ;
36
36
use rustc_session:: config:: { CrateType , ErrorOutputType , OptLevel } ;
37
37
use rustc_session:: search_paths:: PathKind ;
38
- use rustc_session:: { CtfeBacktrace , EarlyErrorHandler } ;
38
+ use rustc_session:: { CtfeBacktrace , EarlyDiagCtxt } ;
39
39
40
40
use miri:: { BacktraceStyle , BorrowTrackerMethod , ProvenanceMode , RetagFields } ;
41
41
@@ -69,8 +69,8 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
69
69
tcx. sess . fatal ( "miri cannot be run on programs that fail compilation" ) ;
70
70
}
71
71
72
- let handler = EarlyErrorHandler :: new ( tcx. sess . opts . error_format ) ;
73
- init_late_loggers ( & handler , tcx) ;
72
+ let early_dcx = EarlyDiagCtxt :: new ( tcx. sess . opts . error_format ) ;
73
+ init_late_loggers ( & early_dcx , tcx) ;
74
74
if !tcx. crate_types ( ) . contains ( & CrateType :: Executable ) {
75
75
tcx. sess . fatal ( "miri only makes sense on bin crates" ) ;
76
76
}
@@ -215,7 +215,7 @@ fn rustc_logger_config() -> rustc_log::LoggerConfig {
215
215
cfg
216
216
}
217
217
218
- fn init_early_loggers ( handler : & EarlyErrorHandler ) {
218
+ fn init_early_loggers ( early_dcx : & EarlyDiagCtxt ) {
219
219
// Note that our `extern crate log` is *not* the same as rustc's; as a result, we have to
220
220
// initialize them both, and we always initialize `miri`'s first.
221
221
let env = env_logger:: Env :: new ( ) . filter ( "MIRI_LOG" ) . write_style ( "MIRI_LOG_STYLE" ) ;
@@ -224,15 +224,15 @@ fn init_early_loggers(handler: &EarlyErrorHandler) {
224
224
// If it is not set, we avoid initializing now so that we can initialize later with our custom
225
225
// settings, and *not* log anything for what happens before `miri` gets started.
226
226
if env:: var_os ( "RUSTC_LOG" ) . is_some ( ) {
227
- rustc_driver:: init_logger ( handler , rustc_logger_config ( ) ) ;
227
+ rustc_driver:: init_logger ( early_dcx , rustc_logger_config ( ) ) ;
228
228
}
229
229
}
230
230
231
- fn init_late_loggers ( handler : & EarlyErrorHandler , tcx : TyCtxt < ' _ > ) {
231
+ fn init_late_loggers ( early_dcx : & EarlyDiagCtxt , tcx : TyCtxt < ' _ > ) {
232
232
// If `RUSTC_LOG` is not set, then `init_early_loggers` did not call
233
233
// `rustc_driver::init_logger`, so we have to do this now.
234
234
if env:: var_os ( "RUSTC_LOG" ) . is_none ( ) {
235
- rustc_driver:: init_logger ( handler , rustc_logger_config ( ) ) ;
235
+ rustc_driver:: init_logger ( early_dcx , rustc_logger_config ( ) ) ;
236
236
}
237
237
238
238
// If `MIRI_BACKTRACE` is set and `RUSTC_CTFE_BACKTRACE` is not, set `RUSTC_CTFE_BACKTRACE`.
@@ -300,7 +300,7 @@ fn parse_comma_list<T: FromStr>(input: &str) -> Result<Vec<T>, T::Err> {
300
300
}
301
301
302
302
fn main ( ) {
303
- let handler = EarlyErrorHandler :: new ( ErrorOutputType :: default ( ) ) ;
303
+ let early_dcx = EarlyDiagCtxt :: new ( ErrorOutputType :: default ( ) ) ;
304
304
305
305
// Snapshot a copy of the environment before `rustc` starts messing with it.
306
306
// (`install_ice_hook` might change `RUST_BACKTRACE`.)
@@ -311,7 +311,7 @@ fn main() {
311
311
// Earliest rustc setup.
312
312
let using_internal_features =
313
313
rustc_driver:: install_ice_hook ( rustc_driver:: DEFAULT_BUG_REPORT_URL , |_| ( ) ) ;
314
- rustc_driver:: init_rustc_env_logger ( & handler ) ;
314
+ rustc_driver:: init_rustc_env_logger ( & early_dcx ) ;
315
315
316
316
let target_crate = if crate_kind == "target" {
317
317
true
@@ -335,7 +335,7 @@ fn main() {
335
335
rustc_driver:: install_ice_hook ( "https://github.com/rust-lang/miri/issues/new" , |_| ( ) ) ;
336
336
337
337
// Init loggers the Miri way.
338
- init_early_loggers ( & handler ) ;
338
+ init_early_loggers ( & early_dcx ) ;
339
339
340
340
// Parse our arguments and split them across `rustc` and `miri`.
341
341
let mut miri_config = miri:: MiriConfig :: default ( ) ;
0 commit comments