From 059dbb7c863e0a086aeb08d7cb86aa538949aa9e Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Mon, 16 Sep 2024 10:26:42 +0200 Subject: [PATCH] Fix run --dep --- miri-script/src/commands.rs | 10 +++++++--- tests/ui.rs | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/miri-script/src/commands.rs b/miri-script/src/commands.rs index 7348acac5a..b18c8453d6 100644 --- a/miri-script/src/commands.rs +++ b/miri-script/src/commands.rs @@ -503,9 +503,13 @@ impl Command { // More flags that we will pass before `flags` // (because `flags` may contain `--`). let mut early_flags = Vec::::new(); - if let Some(target) = &target { - early_flags.push("--target".into()); - early_flags.push(target.into()); + + // In `dep` mode, the target is already passed via `MIRI_TEST_TARGET` + if !dep { + if let Some(target) = &target { + early_flags.push("--target".into()); + early_flags.push(target.into()); + } } early_flags.push("--edition".into()); early_flags.push(edition.as_deref().unwrap_or("2021").into()); diff --git a/tests/ui.rs b/tests/ui.rs index 10b29deefa..d405eb92ad 100644 --- a/tests/ui.rs +++ b/tests/ui.rs @@ -337,6 +337,7 @@ fn run_dep_mode(target: String, args: impl Iterator) -> Result< let build_manager = BuildManager::one_off(config); let mut cmd = test_config.config.program.build(&test_config.config.out_dir); + cmd.arg("--target").arg(test_config.config.target.as_ref().unwrap()); // Build dependencies test_config.apply_custom(&mut cmd, &build_manager).unwrap();