Skip to content

Commit 649c266

Browse files
committed
Auto merge of #119063 - nnethercote:dcx, r=compiler-errors
Consistent `Handler` naming This PR implements the renaming described in rust-lang/compiler-team#699. r? `@compiler-errors`
2 parents 4503a3d + 569fcec commit 649c266

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/bin/miri.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_middle::{
3535
};
3636
use rustc_session::config::{CrateType, ErrorOutputType, OptLevel};
3737
use rustc_session::search_paths::PathKind;
38-
use rustc_session::{CtfeBacktrace, EarlyErrorHandler};
38+
use rustc_session::{CtfeBacktrace, EarlyDiagCtxt};
3939

4040
use miri::{BacktraceStyle, BorrowTrackerMethod, ProvenanceMode, RetagFields};
4141

@@ -69,8 +69,8 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
6969
tcx.sess.fatal("miri cannot be run on programs that fail compilation");
7070
}
7171

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);
7474
if !tcx.crate_types().contains(&CrateType::Executable) {
7575
tcx.sess.fatal("miri only makes sense on bin crates");
7676
}
@@ -215,7 +215,7 @@ fn rustc_logger_config() -> rustc_log::LoggerConfig {
215215
cfg
216216
}
217217

218-
fn init_early_loggers(handler: &EarlyErrorHandler) {
218+
fn init_early_loggers(early_dcx: &EarlyDiagCtxt) {
219219
// Note that our `extern crate log` is *not* the same as rustc's; as a result, we have to
220220
// initialize them both, and we always initialize `miri`'s first.
221221
let env = env_logger::Env::new().filter("MIRI_LOG").write_style("MIRI_LOG_STYLE");
@@ -224,15 +224,15 @@ fn init_early_loggers(handler: &EarlyErrorHandler) {
224224
// If it is not set, we avoid initializing now so that we can initialize later with our custom
225225
// settings, and *not* log anything for what happens before `miri` gets started.
226226
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());
228228
}
229229
}
230230

231-
fn init_late_loggers(handler: &EarlyErrorHandler, tcx: TyCtxt<'_>) {
231+
fn init_late_loggers(early_dcx: &EarlyDiagCtxt, tcx: TyCtxt<'_>) {
232232
// If `RUSTC_LOG` is not set, then `init_early_loggers` did not call
233233
// `rustc_driver::init_logger`, so we have to do this now.
234234
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());
236236
}
237237

238238
// 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> {
300300
}
301301

302302
fn main() {
303-
let handler = EarlyErrorHandler::new(ErrorOutputType::default());
303+
let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());
304304

305305
// Snapshot a copy of the environment before `rustc` starts messing with it.
306306
// (`install_ice_hook` might change `RUST_BACKTRACE`.)
@@ -311,7 +311,7 @@ fn main() {
311311
// Earliest rustc setup.
312312
let using_internal_features =
313313
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);
315315

316316
let target_crate = if crate_kind == "target" {
317317
true
@@ -335,7 +335,7 @@ fn main() {
335335
rustc_driver::install_ice_hook("https://github.com/rust-lang/miri/issues/new", |_| ());
336336

337337
// Init loggers the Miri way.
338-
init_early_loggers(&handler);
338+
init_early_loggers(&early_dcx);
339339

340340
// Parse our arguments and split them across `rustc` and `miri`.
341341
let mut miri_config = miri::MiriConfig::default();

src/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ pub fn report_error<'tcx, 'mir>(
384384

385385
// Include a note like `std` does when we omit frames from a backtrace
386386
if was_pruned {
387-
ecx.tcx.sess.diagnostic().note(
387+
ecx.tcx.sess.dcx().note(
388388
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
389389
);
390390
}
@@ -431,7 +431,7 @@ pub fn report_leaks<'mir, 'tcx>(
431431
);
432432
}
433433
if any_pruned {
434-
ecx.tcx.sess.diagnostic().note(
434+
ecx.tcx.sess.dcx().note(
435435
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
436436
);
437437
}
@@ -456,7 +456,7 @@ pub fn report_msg<'tcx>(
456456
let mut err = match diag_level {
457457
DiagLevel::Error => sess.struct_span_err(span, title).forget_guarantee(),
458458
DiagLevel::Warning => sess.struct_span_warn(span, title),
459-
DiagLevel::Note => sess.diagnostic().struct_span_note(span, title),
459+
DiagLevel::Note => sess.dcx().struct_span_note(span, title),
460460
};
461461

462462
// Show main message.

0 commit comments

Comments
 (0)