File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1587,3 +1587,25 @@ fn host_config_rustflags_with_target() {
1587
1587
. arg ( "host.rustflags=[\" --cfg=foo\" ]" )
1588
1588
. run ( ) ;
1589
1589
}
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
+ }
You can’t perform that action at this time.
0 commit comments