Skip to content

Commit 4f999b7

Browse files
committed
Add test verifying behavior in rust-lang#10744
1 parent c1fe2bd commit 4f999b7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/testsuite/rustflags.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,3 +1587,25 @@ 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()
1596+
.file(
1597+
"src/lib.rs",
1598+
r#"#[cfg(feature = "flag")] compile_error!("flag passed");"#,
1599+
)
1600+
.build();
1601+
1602+
// Use RUSTFLAGS to pass an argument that would generate an error
1603+
// but it is ignored.
1604+
p.cargo("check")
1605+
.masquerade_as_nightly_cargo(&["target-applies-to-host"])
1606+
.arg("-Ztarget-applies-to-host")
1607+
.env("CARGO_TARGET_APPLIES_TO_HOST", "false")
1608+
.env("RUSTFLAGS", r#"--cfg feature="flag""#)
1609+
.with_status(0)
1610+
.run();
1611+
}

0 commit comments

Comments
 (0)