@@ -1579,6 +1579,86 @@ foo v0.0.0 ([ROOT]/foo)
15791579 . run ( ) ;
15801580}
15811581
1582+ /// From issue #10593
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/main.rs" , "fn main() {}" )
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+ p. cargo ( "check -Z bindeps" )
1637+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
1638+ . with_stderr_data ( str![ [ r#"
1639+ [LOCKING] 2 packages to latest compatible versions
1640+ [COMPILING] baz v0.1.0 ([ROOT]/foo/baz)
1641+ [COMPILING] bar v0.1.0 ([ROOT]/foo/bar)
1642+ [CHECKING] foo v0.1.0 ([ROOT]/foo)
1643+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1644+
1645+ "# ] ] )
1646+ . with_status ( 0 )
1647+ . run ( ) ;
1648+
1649+ // TODO This command currently fails due to a bug in cargo but it should be fixed so that it succeeds in the future.
1650+ p. cargo ( "tree -Z bindeps" )
1651+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
1652+ . with_stderr_data (
1653+ r#"...
1654+ no entry found for key
1655+ ...
1656+ "# ,
1657+ )
1658+ . with_status ( 101 )
1659+ . run ( ) ;
1660+ }
1661+
15821662#[ cargo_test]
15831663fn targets_are_picked_up_from_non_workspace_artifact_deps ( ) {
15841664 if cross_compile:: disabled ( ) {
0 commit comments