do not run miri for the dependency build

and reset MIRIFLAGS as well just to be safe
This commit is contained in:
Ralf Jung 2026-02-02 19:31:40 +01:00
parent 62d518190e
commit c89a88ed1b
3 changed files with 15 additions and 5 deletions

View file

@ -63,6 +63,9 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
"setup" => MiriCommand::Setup,
"test" | "t" | "run" | "r" | "nextest" => MiriCommand::Forward(subcommand),
"clean" => MiriCommand::Clean,
// For use by the `./miri test` dependency builder.
"build" if env::var_os("MIRI_BUILD_TEST_DEPS").is_some() =>
MiriCommand::Forward("build".into()),
_ => {
// Check for version and help flags.
if has_arg_flag("--help") || has_arg_flag("-h") {

View file

@ -1 +1,3 @@
fn main() {}
fn main() {
unreachable!()
}

View file

@ -132,14 +132,19 @@ fn miri_config(
// (It's a separate crate, so we don't get an env var from cargo.)
program: miri_path()
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
// There is no `cargo miri build` so we just use `cargo miri run`.
// Add `-Zbinary-dep-depinfo` since it is needed for bootstrap builds (and doesn't harm otherwise).
args: ["miri", "run", "--quiet", "-Zbinary-dep-depinfo"]
args: ["miri", "build", "-Zbinary-dep-depinfo"]
.into_iter()
.map(Into::into)
.collect(),
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
envs: vec![("RUSTFLAGS".into(), None)],
envs: vec![
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
("RUSTFLAGS".into(), None),
// Reset `MIRIFLAGS` because it caused trouble in the past and should not be needed.
("MIRIFLAGS".into(), None),
// Allow `cargo miri build`.
("MIRI_BUILD_TEST_DEPS".into(), Some("1".into())),
],
..CommandBuilder::cargo()
},
crate_manifest_path: Path::new("tests/deps").join("Cargo.toml"),