Skip to content

Commit ec9a9af

Browse files
committed
Add test verifying behavior in #10744
1 parent c1fe2bd commit ec9a9af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/testsuite/rustflags.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,3 +1587,20 @@ fn host_config_rustflags_with_target() {
15871587
.arg("host.rustflags=[\"--cfg=foo\"]")
15881588
.run();
15891589
}
1590+
1591+
#[cargo_test]
1592+
fn target_applies_to_host_rustflags_works() {
1593+
// Ensures that rustflags are passed to the target when
1594+
// target_applies_to_host=false
1595+
let p = project().file("src/lib.rs", r#"#[cfg(feature = "flag")] compile_error!("flag passed");"#).build();
1596+
1597+
// Use RUSTFLAGS to pass an argument that would generate an error
1598+
// but it is ignored.
1599+
p.cargo("check")
1600+
.masquerade_as_nightly_cargo(&["target-applies-to-host"])
1601+
.arg("-Ztarget-applies-to-host")
1602+
.env("CARGO_TARGET_APPLIES_TO_HOST", "false")
1603+
.env("RUSTFLAGS", r#"--cfg feature="flag""#)
1604+
.with_status(0)
1605+
.run();
1606+
}

0 commit comments

Comments
 (0)