@@ -1657,6 +1657,91 @@ no entry found for key
1657
1657
. run ( ) ;
1658
1658
}
1659
1659
1660
+ #[ cargo_test]
1661
+ fn check_bindep_depending_on_build_only_dep_with_optional_dep ( ) {
1662
+ if cross_compile:: disabled ( ) {
1663
+ return ;
1664
+ }
1665
+ // i686-unknown-linux-gnu did not trigger a panic so we need to manually specify wasm32-unknown-unknown instead of relying on cross_compile::alternate()
1666
+ // This is possibly because the `cfg(unix)` later on needs to evaluate to false on the cross compile but true on the host.
1667
+ let target = "wasm32-unknown-unknown" ;
1668
+
1669
+ let p = project ( )
1670
+ . file (
1671
+ "Cargo.toml" ,
1672
+ & r#"
1673
+ [package]
1674
+ name = "foo"
1675
+ version = "0.0.0"
1676
+ authors = []
1677
+ resolver = "2"
1678
+ edition = "2015"
1679
+
1680
+ [dependencies]
1681
+ bindep = { path = "bindep", artifact = "bin", target = "$TARGET" }
1682
+ "#
1683
+ . replace ( "$TARGET" , target) ,
1684
+ )
1685
+ . file ( "src/lib.rs" , "" )
1686
+ . file (
1687
+ "bindep/Cargo.toml" ,
1688
+ & r#"
1689
+ [package]
1690
+ name = "bindep"
1691
+ version = "0.0.0"
1692
+ authors = []
1693
+
1694
+ [dependencies]
1695
+ depends-on-build-only-dep = { path = "../depends-on-build-only-dep" }
1696
+ "# ,
1697
+ )
1698
+ . file ( "bindep/src/main.rs" , "fn main() {}" )
1699
+ . file (
1700
+ "depends-on-build-only-dep/Cargo.toml" ,
1701
+ & r#"
1702
+ [package]
1703
+ name = "depends-on-build-only-dep"
1704
+ version = "0.0.0"
1705
+ authors = []
1706
+
1707
+ [build-dependencies]
1708
+ build-only-dep = { path = "../build-only-dep" }
1709
+ "# ,
1710
+ )
1711
+ . file ( "depends-on-build-only-dep/src/lib.rs" , "" )
1712
+ . file ( "depends-on-build-only-dep/build.rs" , "fn main() {}" )
1713
+ . file (
1714
+ "build-only-dep/Cargo.toml" ,
1715
+ & r#"
1716
+ [package]
1717
+ name = "build-only-dep"
1718
+ version = "0.0.0"
1719
+ authors = []
1720
+
1721
+ [target.'cfg(unix)'.dependencies]
1722
+ some-leaf-dep = { path = "../some-leaf-dep" }
1723
+ "# ,
1724
+ )
1725
+ . file ( "build-only-dep/src/lib.rs" , "" )
1726
+ . file (
1727
+ "some-leaf-dep/Cargo.toml" ,
1728
+ & basic_manifest ( "some-leaf-dep" , "0.0.1" ) ,
1729
+ )
1730
+ . file ( "some-leaf-dep/src/lib.rs" , "" )
1731
+ . build ( ) ;
1732
+
1733
+ // TODO: This command currently fails due to a bug in cargo but it should be fixed so that it succeeds in the future.
1734
+ p. cargo ( "check -Z bindeps" )
1735
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
1736
+ . with_stderr_data (
1737
+ r#"...
1738
+ [..]did not find features for (PackageId { name: "some-leaf-dep", version: "0.0.1", source: "[..]" }, ArtifactDep(CompileTarget { name: "wasm32-unknown-unknown" })) within activated_features:[..]
1739
+ ...
1740
+ "# )
1741
+ . with_status ( 101 )
1742
+ . run ( ) ;
1743
+ }
1744
+
1660
1745
#[ cargo_test]
1661
1746
fn targets_are_picked_up_from_non_workspace_artifact_deps ( ) {
1662
1747
if cross_compile:: disabled ( ) {
0 commit comments