diff options
| author | bors <bors@rust-lang.org> | 2024-03-26 16:09:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-26 16:09:03 +0000 |
| commit | 3c041c4e45e2a3b11848726249015069dd8a2d55 (patch) | |
| tree | 528a460142c65b72e13756661ee96176c86fdc7f /src | |
| parent | 9f11ed76ffd443badf6f814b9ea06173e148747b (diff) | |
| parent | a8fb4a0187ee741f66f49dbe69dc4f08632d58a7 (diff) | |
| download | rust-3c041c4e45e2a3b11848726249015069dd8a2d55.tar.gz rust-3c041c4e45e2a3b11848726249015069dd8a2d55.zip | |
Auto merge of #3421 - RalfJung:remove-remove-var, r=RalfJung
avoid mutating the global environment `remove_var` is just as bad as `set_var`, let's not do that.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/miri/cargo-miri/src/phases.rs | 10 | ||||
| -rw-r--r-- | src/tools/miri/cargo-miri/src/util.rs | 7 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/tools/miri/cargo-miri/src/phases.rs b/src/tools/miri/cargo-miri/src/phases.rs index f49bc6d23b9..9428f76debd 100644 --- a/src/tools/miri/cargo-miri/src/phases.rs +++ b/src/tools/miri/cargo-miri/src/phases.rs @@ -301,11 +301,6 @@ pub fn phase_rustc(mut args: impl Iterator<Item = String>, phase: RustcPhase) { } } - // phase_cargo_miri set `MIRI_BE_RUSTC` for when build scripts directly invoke the driver; - // however, if we get called back by cargo here, we'll carefully compute the right flags - // ourselves, so we first un-do what the earlier phase did. - env::remove_var("MIRI_BE_RUSTC"); - let verbose = std::env::var("MIRI_VERBOSE") .map_or(0, |verbose| verbose.parse().expect("verbosity flag must be an integer")); let target_crate = is_target_crate(); @@ -489,11 +484,6 @@ pub enum RunnerPhase { } pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: RunnerPhase) { - // phase_cargo_miri set `MIRI_BE_RUSTC` for when build scripts directly invoke the driver; - // however, if we get called back by cargo here, we'll carefully compute the right flags - // ourselves, so we first un-do what the earlier phase did. - env::remove_var("MIRI_BE_RUSTC"); - let verbose = std::env::var("MIRI_VERBOSE") .map_or(0, |verbose| verbose.parse().expect("verbosity flag must be an integer")); diff --git a/src/tools/miri/cargo-miri/src/util.rs b/src/tools/miri/cargo-miri/src/util.rs index 6c1a074cd8c..d99957d9c22 100644 --- a/src/tools/miri/cargo-miri/src/util.rs +++ b/src/tools/miri/cargo-miri/src/util.rs @@ -101,7 +101,12 @@ pub fn find_miri() -> PathBuf { } pub fn miri() -> Command { - Command::new(find_miri()) + let mut cmd = Command::new(find_miri()); + // We never want to inherit this from the environment. + // However, this is sometimes set in the environment to work around build scripts that don't + // honor RUSTC_WRAPPER. So remove it again in case it is set. + cmd.env_remove("MIRI_BE_RUSTC"); + cmd } pub fn miri_for_host() -> Command { |
