From 186c1d3684a1edb0357278e26b7779e2854c3ee7 Mon Sep 17 00:00:00 2001 From: beetrees Date: Mon, 15 May 2023 21:22:18 +0100 Subject: [PATCH] Use `rustc_driver::args::raw_args()` in Miri --- src/tools/miri/src/bin/miri.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index 095ba17367135..c08c09395c1a6 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -346,6 +346,8 @@ fn main() { // (`install_ice_hook` might change `RUST_BACKTRACE`.) let env_snapshot = env::vars_os().collect::>(); + let args = rustc_driver::args::raw_args(&early_dcx).unwrap_or_else(|_| std::process::exit(rustc_driver::EXIT_FAILURE)); + // If the environment asks us to actually be rustc, then do that. if let Some(crate_kind) = env::var_os("MIRI_BE_RUSTC") { // Earliest rustc setup. @@ -363,7 +365,7 @@ fn main() { // We cannot use `rustc_driver::main` as we need to adjust the CLI arguments. run_compiler( - env::args().collect(), + args, target_crate, &mut MiriBeRustCompilerCalls { target_crate }, using_internal_features, @@ -386,7 +388,7 @@ fn main() { // If user has explicitly enabled/disabled isolation let mut isolation_enabled: Option = None; - for arg in env::args() { + for arg in args { if rustc_args.is_empty() { // Very first arg: binary name. rustc_args.push(arg);