Skip to content

Commit 3f92a79

Browse files
Nemo157jyn514
authored andcommitted
Pass rustc-args to build dependencies too
This was the previous behaviour before #1559 for the default target and is most likely expected by users.
1 parent e540be4 commit 3f92a79

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

crates/metadata/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ impl Metadata {
281281
let rustflags =
282282
toml::to_string(&self.rustc_args).expect("serializing a string should never fail");
283283
cargo_args.push(format!("build.rustflags={}", rustflags));
284+
cargo_args.push("-Zhost-config".into());
285+
cargo_args.push("-Ztarget-applies-to-host".into());
286+
cargo_args.push("--config".into());
287+
cargo_args.push(format!("host.rustflags={}", rustflags));
284288
}
285289

286290
if !all_rustdoc_args.is_empty() {

src/docbuilder/rustwide_builder.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,4 +1081,16 @@ mod tests {
10811081
Ok(())
10821082
});
10831083
}
1084+
1085+
#[test]
1086+
#[ignore]
1087+
fn test_rustflags_are_passed_to_build_script() {
1088+
wrapper(|env| {
1089+
let crate_ = "proc-macro2";
1090+
let version = "1.0.33";
1091+
let mut builder = RustwideBuilder::init(env).unwrap();
1092+
assert!(builder.build_package(crate_, version, PackageKind::CratesIo)?);
1093+
Ok(())
1094+
});
1095+
}
10841096
}

0 commit comments

Comments
 (0)