@@ -1642,3 +1642,62 @@ fn target_applies_to_host_rustdocflags_works() {
1642
1642
)
1643
1643
. run ( ) ;
1644
1644
}
1645
+
1646
+ #[ cargo_test]
1647
+ fn host_config_shared_build_dep ( ) {
1648
+ // rust-lang/cargo#14253
1649
+ Package :: new ( "cc" , "1.0.0" ) . publish ( ) ;
1650
+ let p = project ( )
1651
+ . file (
1652
+ "Cargo.toml" ,
1653
+ r#"
1654
+ [package]
1655
+ name = "bootstrap"
1656
+ edition = "2021"
1657
+
1658
+ [dependencies]
1659
+ cc = "1.0.0"
1660
+
1661
+ [build-dependencies]
1662
+ cc = "1.0.0"
1663
+
1664
+ [profile.dev]
1665
+ debug = 0
1666
+ "# ,
1667
+ )
1668
+ . file ( "src/lib.rs" , "" )
1669
+ . file ( "build.rs" , "fn main() {}" )
1670
+ . build ( ) ;
1671
+
1672
+ p. cargo ( "build" )
1673
+ . masquerade_as_nightly_cargo ( & [ "target-applies-to-host" ] )
1674
+ . arg ( "-Ztarget-applies-to-host" )
1675
+ . arg ( "--config=target-applies-to-host=false" )
1676
+ . env ( "RUSTFLAGS" , "--cfg foo" )
1677
+ . with_status ( 101 )
1678
+ // Sometimes it compiles. Not deterministic...
1679
+ . with_stderr_data ( str![ [ r#"
1680
+ [UPDATING] `dummy-registry` index
1681
+ [LOCKING] 2 packages to latest compatible versions
1682
+ [DOWNLOADING] crates ...
1683
+ [DOWNLOADED] cc v1.0.0 (registry `dummy-registry`)
1684
+ [WARNING] output filename collision.
1685
+ The lib target `cc` in package `cc v1.0.0` has the same output filename as the lib target `cc` in package `cc v1.0.0`.
1686
+ Colliding filename is: [ROOT]/foo/target/debug/deps/libcc-[HASH].rlib
1687
+ The targets should have unique names.
1688
+ Consider changing their names to be unique or compiling them separately.
1689
+ This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
1690
+ [WARNING] output filename collision.
1691
+ The lib target `cc` in package `cc v1.0.0` has the same output filename as the lib target `cc` in package `cc v1.0.0`.
1692
+ Colliding filename is: [ROOT]/foo/target/debug/deps/libcc-[HASH].rmeta
1693
+ The targets should have unique names.
1694
+ Consider changing their names to be unique or compiling them separately.
1695
+ This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
1696
+ [COMPILING] cc v1.0.0
1697
+ [ERROR] failed to build archive: No such file or directory
1698
+
1699
+ [ERROR] could not compile `cc` (lib) due to 1 previous error
1700
+
1701
+ "# ] ] )
1702
+ . run ( ) ;
1703
+ }
0 commit comments