Skip to content

Commit 0a19f60

Browse files
committed
Auto merge of #113105 - matthiaskrgr:rollup-rci0uym, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #112207 (Add trustzone and virtualization target features for aarch32.) - #112454 (Make compiletest aware of targets without dynamic linking) - #112628 (Allow comparing `Box`es with different allocators) - #112692 (Provide more context for `rustc +nightly -Zunstable-options` on stable) - #112972 (Make `UnwindAction::Continue` explicit in MIR dump) - #113020 (Add tests impl via obj unless denied) - #113084 (Simplify some conditions) - #113103 (Normalize types when applying uninhabited predicate.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9995006 + 853afd7 commit 0a19f60

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/bin/miri.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ use rustc_middle::{
3131
query::{ExternProviders, LocalCrate},
3232
ty::TyCtxt,
3333
};
34-
use rustc_session::config::OptLevel;
35-
36-
use rustc_session::{config::CrateType, search_paths::PathKind, CtfeBacktrace};
34+
use rustc_session::{EarlyErrorHandler, CtfeBacktrace};
35+
use rustc_session::config::{OptLevel, CrateType, ErrorOutputType};
36+
use rustc_session::search_paths::PathKind;
3737

3838
use miri::{BacktraceStyle, BorrowTrackerMethod, ProvenanceMode, RetagFields};
3939

@@ -59,15 +59,16 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
5959

6060
fn after_analysis<'tcx>(
6161
&mut self,
62+
handler: &EarlyErrorHandler,
6263
_: &rustc_interface::interface::Compiler,
6364
queries: &'tcx rustc_interface::Queries<'tcx>,
6465
) -> Compilation {
6566
queries.global_ctxt().unwrap().enter(|tcx| {
6667
if tcx.sess.compile_status().is_err() {
6768
tcx.sess.fatal("miri cannot be run on programs that fail compilation");
6869
}
69-
70-
init_late_loggers(tcx);
70+
;
71+
init_late_loggers(handler, tcx);
7172
if !tcx.sess.crate_types().contains(&CrateType::Executable) {
7273
tcx.sess.fatal("miri only makes sense on bin crates");
7374
}
@@ -181,7 +182,7 @@ macro_rules! show_error {
181182
($($tt:tt)*) => { show_error(&format_args!($($tt)*)) };
182183
}
183184

184-
fn init_early_loggers() {
185+
fn init_early_loggers(handler: &EarlyErrorHandler) {
185186
// Note that our `extern crate log` is *not* the same as rustc's; as a result, we have to
186187
// initialize them both, and we always initialize `miri`'s first.
187188
let env = env_logger::Env::new().filter("MIRI_LOG").write_style("MIRI_LOG_STYLE");
@@ -195,11 +196,11 @@ fn init_early_loggers() {
195196
// later with our custom settings, and *not* log anything for what happens before
196197
// `miri` gets started.
197198
if env::var_os("RUSTC_LOG").is_some() {
198-
rustc_driver::init_rustc_env_logger();
199+
rustc_driver::init_rustc_env_logger(handler);
199200
}
200201
}
201202

202-
fn init_late_loggers(tcx: TyCtxt<'_>) {
203+
fn init_late_loggers(handler: &EarlyErrorHandler, tcx: TyCtxt<'_>) {
203204
// We initialize loggers right before we start evaluation. We overwrite the `RUSTC_LOG`
204205
// env var if it is not set, control it based on `MIRI_LOG`.
205206
// (FIXME: use `var_os`, but then we need to manually concatenate instead of `format!`.)
@@ -218,7 +219,7 @@ fn init_late_loggers(tcx: TyCtxt<'_>) {
218219
} else {
219220
env::set_var("RUSTC_LOG", &var);
220221
}
221-
rustc_driver::init_rustc_env_logger();
222+
rustc_driver::init_rustc_env_logger(handler);
222223
}
223224
}
224225

@@ -284,6 +285,8 @@ fn parse_comma_list<T: FromStr>(input: &str) -> Result<Vec<T>, T::Err> {
284285
}
285286

286287
fn main() {
288+
let handler = EarlyErrorHandler::new(ErrorOutputType::default());
289+
287290
// Snapshot a copy of the environment before `rustc` starts messing with it.
288291
// (`install_ice_hook` might change `RUST_BACKTRACE`.)
289292
let env_snapshot = env::vars_os().collect::<Vec<_>>();
@@ -292,7 +295,7 @@ fn main() {
292295
if let Some(crate_kind) = env::var_os("MIRI_BE_RUSTC") {
293296
// Earliest rustc setup.
294297
rustc_driver::install_ice_hook(rustc_driver::DEFAULT_BUG_REPORT_URL, |_| ());
295-
rustc_driver::init_rustc_env_logger();
298+
rustc_driver::init_rustc_env_logger(&handler);
296299

297300
let target_crate = if crate_kind == "target" {
298301
true
@@ -314,7 +317,7 @@ fn main() {
314317
rustc_driver::install_ice_hook("https://github.com/rust-lang/miri/issues/new", |_| ());
315318

316319
// Init loggers the Miri way.
317-
init_early_loggers();
320+
init_early_loggers(&handler);
318321

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

0 commit comments

Comments
 (0)