From e3d8dab0bb4002d077c35edda73c61cb1c0c8703 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 18 Oct 2024 09:13:12 -0700 Subject: [PATCH] Combine trybuild rustflags with target-specific rustflags --- src/cargo.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cargo.rs b/src/cargo.rs index ca21478..8f9142c 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -7,6 +7,7 @@ use serde_derive::Deserialize; use std::path::PathBuf; use std::process::{Command, Output, Stdio}; use std::{env, fs, iter}; +use target_triple::TARGET; #[derive(Deserialize)] pub(crate) struct Metadata { @@ -41,7 +42,11 @@ fn cargo(project: &Project) -> Command { cmd.env_remove("RUSTFLAGS"); cmd.env("CARGO_INCREMENTAL", "0"); cmd.arg("--offline"); - cmd.arg(format!("--config=build.rustflags={}", rustflags::toml())); + + let rustflags = rustflags::toml(); + cmd.arg(format!("--config=build.rustflags={rustflags}")); + cmd.arg(format!("--config=target.{TARGET}.rustflags={rustflags}")); + cmd } @@ -199,6 +204,6 @@ fn target() -> Vec<&'static str> { if cfg!(trybuild_no_target) { vec![] } else { - vec!["--target", target_triple::TARGET] + vec!["--target", TARGET] } }