Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fb428df

Browse files
committed
avoid redundant setting of env vars in phase_runner
1 parent 7c99f90 commit fb428df

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

cargo-miri/bin.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,14 +1008,16 @@ fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: RunnerPhas
10081008
// Set missing env vars. We prefer build-time env vars over run-time ones; see
10091009
// <https://github.com/rust-lang/miri/issues/1661> for the kind of issue that fixes.
10101010
for (name, val) in info.env {
1011-
if verbose > 0 {
1012-
if let Some(old_val) = env::var_os(&name) {
1013-
if old_val != val {
1014-
eprintln!(
1015-
"[cargo-miri runner] Overwriting run-time env var {:?}={:?} with build-time value {:?}",
1016-
name, old_val, val
1017-
);
1018-
}
1011+
if let Some(old_val) = env::var_os(&name) {
1012+
if old_val == val {
1013+
// This one did not actually change, no need to re-set it.
1014+
// (This keeps the `debug_cmd` below more manageable.)
1015+
continue;
1016+
} else if verbose > 0 {
1017+
eprintln!(
1018+
"[cargo-miri runner] Overwriting run-time env var {:?}={:?} with build-time value {:?}",
1019+
name, old_val, val
1020+
);
10191021
}
10201022
}
10211023
cmd.env(name, val);

0 commit comments

Comments
 (0)