Skip to content

Commit 987702f

Browse files
committed
Refator DependencyBuilder construction
1 parent 9f9f198 commit 987702f

File tree

1 file changed

+15
-14
lines changed
  • src/tools/miri/tests

1 file changed

+15
-14
lines changed

src/tools/miri/tests/ui.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,23 @@ fn miri_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
118118
config.comment_defaults.base().add_custom("edition", Edition("2021".into()));
119119

120120
if with_dependencies {
121-
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
122-
// (It's a separate crate, so we don't get an env var from cargo.)
123-
let mut program = CommandBuilder::cargo();
124-
program.program = {
125-
let mut prog = miri_path();
126-
prog.set_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX));
127-
prog
128-
};
129-
let builder_args = ["miri", "run"]; // There is no `cargo miri build` so we just use `cargo miri run`.
130-
program.args = builder_args.into_iter().map(Into::into).collect();
131-
let crate_manifest_path = Path::new("test_dependencies").join("Cargo.toml");
132-
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
133-
program.envs.push(("RUSTFLAGS".into(), None));
134121
config.comment_defaults.base().set_custom(
135122
"dependencies",
136-
DependencyBuilder { program, crate_manifest_path, build_std: None },
123+
DependencyBuilder {
124+
program: CommandBuilder {
125+
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
126+
// (It's a separate crate, so we don't get an env var from cargo.)
127+
program: miri_path()
128+
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
129+
// There is no `cargo miri build` so we just use `cargo miri run`.
130+
args: ["miri", "run"].into_iter().map(Into::into).collect(),
131+
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
132+
envs: vec![("RUSTFLAGS".into(), None)],
133+
..CommandBuilder::cargo()
134+
},
135+
crate_manifest_path: Path::new("test_dependencies").join("Cargo.toml"),
136+
build_std: None,
137+
},
137138
);
138139
}
139140
config

0 commit comments

Comments
 (0)