@@ -1579,6 +1579,84 @@ foo v0.0.0 ([ROOT]/foo)
1579
1579
. run ( ) ;
1580
1580
}
1581
1581
1582
+ /// From issue #10061
1583
+ /// The case where:
1584
+ /// * artifact dep is { target = <specified> }
1585
+ /// * dependency of that artifact dependency specifies the same target
1586
+ /// * the target is not activated.
1587
+ #[ cargo_test]
1588
+ fn dep_of_artifact_dep_same_target_specified ( ) {
1589
+ if cross_compile:: disabled ( ) {
1590
+ return ;
1591
+ }
1592
+ let target = cross_compile:: alternate ( ) ;
1593
+ let p = project ( )
1594
+ . file (
1595
+ "Cargo.toml" ,
1596
+ & format ! (
1597
+ r#"
1598
+ [package]
1599
+ name = "foo"
1600
+ version = "0.1.0"
1601
+ edition = "2015"
1602
+ resolver = "2"
1603
+
1604
+ [dependencies]
1605
+ bar = {{ path = "bar", artifact = "bin", target = "{target}" }}
1606
+ "# ,
1607
+ ) ,
1608
+ )
1609
+ . file ( "src/lib.rs" , "" )
1610
+ . file (
1611
+ "bar/Cargo.toml" ,
1612
+ & format ! (
1613
+ r#"
1614
+ [package]
1615
+ name = "bar"
1616
+ version = "0.1.0"
1617
+
1618
+ [target.{target}.dependencies]
1619
+ baz = {{ path = "../baz" }}
1620
+ "# ,
1621
+ ) ,
1622
+ )
1623
+ . file ( "bar/src/lib.rs" , "" )
1624
+ . file (
1625
+ "baz/Cargo.toml" ,
1626
+ r#"
1627
+ [package]
1628
+ name = "baz"
1629
+ version = "0.1.0"
1630
+
1631
+ "# ,
1632
+ )
1633
+ . file ( "baz/src/lib.rs" , "" )
1634
+ . build ( ) ;
1635
+
1636
+ // TODO This command currently fails due to a bug in cargo but it should be fixed so that it succeeds in the future.
1637
+ p. cargo ( "check -Z bindeps" )
1638
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
1639
+ . with_stderr_data ( str![ [ r#"
1640
+ [LOCKING] 2 packages to latest compatible versions
1641
+ [ERROR] dependency `bar` in package `foo` requires a `bin` artifact to be present.
1642
+
1643
+ "# ] ] )
1644
+ . with_status ( 101 )
1645
+ . run ( ) ;
1646
+
1647
+ // TODO This command currently fails due to a bug in cargo but it should be fixed so that it succeeds in the future.
1648
+ p. cargo ( "tree -Z bindeps" )
1649
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
1650
+ . with_stderr_data (
1651
+ r#"...
1652
+ no entry found for key
1653
+ ...
1654
+ "# ,
1655
+ )
1656
+ . with_status ( 101 )
1657
+ . run ( ) ;
1658
+ }
1659
+
1582
1660
#[ cargo_test]
1583
1661
fn targets_are_picked_up_from_non_workspace_artifact_deps ( ) {
1584
1662
if cross_compile:: disabled ( ) {
0 commit comments