@@ -1686,6 +1686,116 @@ repository = "foo"
16861686 ) ;
16871687}
16881688
1689+ #[ cargo_test]
1690+ fn publish_with_feature_point_diff_kinds_dep ( ) {
1691+ let registry = RegistryBuilder :: new ( ) . http_api ( ) . http_index ( ) . build ( ) ;
1692+ Package :: new ( "normal-only" , "1.0.0" )
1693+ . feature ( "cat" , & [ ] )
1694+ . publish ( ) ;
1695+ Package :: new ( "build-only" , "1.0.0" )
1696+ . feature ( "cat" , & [ ] )
1697+ . publish ( ) ;
1698+ Package :: new ( "normal-and-dev" , "1.0.0" )
1699+ . feature ( "cat" , & [ ] )
1700+ . publish ( ) ;
1701+ Package :: new ( "target-normal-only" , "1.0.0" )
1702+ . feature ( "cat" , & [ ] )
1703+ . publish ( ) ;
1704+ Package :: new ( "target-build-only" , "1.0.0" )
1705+ . feature ( "cat" , & [ ] )
1706+ . publish ( ) ;
1707+ Package :: new ( "target-normal-and-dev" , "1.0.0" )
1708+ . feature ( "cat" , & [ ] )
1709+ . publish ( ) ;
1710+ let p = project ( )
1711+ . file (
1712+ "Cargo.toml" ,
1713+ r#"
1714+ [package]
1715+ name = "foo"
1716+ version = "0.1.0"
1717+ edition = "2015"
1718+ authors = []
1719+ license = "MIT"
1720+ description = "foo"
1721+ documentation = "foo"
1722+ homepage = "foo"
1723+ repository = "foo"
1724+
1725+
1726+ [features]
1727+ foo_feature = [
1728+ "normal-only/cat",
1729+ "build-only/cat",
1730+ "dev-only/cat",
1731+ "normal-and-dev/cat",
1732+ "target-normal-only/cat",
1733+ "target-build-only/cat",
1734+ "target-dev-only/cat",
1735+ "target-normal-and-dev/cat",
1736+ ]
1737+
1738+ [dependencies]
1739+ normal-only = { version = "1.0", features = ["cat"] }
1740+ normal-and-dev = { version = "1.0", features = ["cat"] }
1741+
1742+ [build-dependencies]
1743+ build-only = { version = "1.0", features = ["cat"] }
1744+
1745+ [dev-dependencies]
1746+ dev-only = { path = "../dev-only", features = ["cat"] }
1747+ normal-and-dev = { version = "1.0", features = ["cat"] }
1748+
1749+ [target.'cfg(unix)'.dependencies]
1750+ target-normal-only = { version = "1.0", features = ["cat"] }
1751+ target-normal-and-dev = { version = "1.0", features = ["cat"] }
1752+
1753+ [target.'cfg(unix)'.build-dependencies]
1754+ target-build-only = { version = "1.0", features = ["cat"] }
1755+
1756+ [target.'cfg(unix)'.dev-dependencies]
1757+ target-dev-only = { path = "../dev-only", features = ["cat"] }
1758+ target-normal-and-dev = { version = "1.0", features = ["cat"] }
1759+ "# ,
1760+ )
1761+ . file ( "src/main.rs" , "" )
1762+ . file (
1763+ "dev-only/Cargo.toml" ,
1764+ r#"
1765+ [package]
1766+ name = "dev-only"
1767+ version = "0.1.0"
1768+ edition = "2015"
1769+ authors = []
1770+
1771+ [features]
1772+ cat = []
1773+ "# ,
1774+ )
1775+ . file (
1776+ "dev-only/src/lib.rs" ,
1777+ r#"
1778+ #[cfg(feature = "cat")]
1779+ pub fn cat() {}
1780+ "# ,
1781+ )
1782+ . build ( ) ;
1783+
1784+ p. cargo ( "publish --no-verify" )
1785+ . replace_crates_io ( registry. index_url ( ) )
1786+ . with_status ( 101 )
1787+ . with_stderr (
1788+ "\
1789+ [UPDATING] [..]
1790+ [PACKAGING] foo v0.1.0 [..]
1791+ [ERROR] failed to prepare local package for uploading
1792+
1793+ Caused by:
1794+ feature `foo_feature` includes `dev-only/cat`, but `dev-only` is not a dependency
1795+ " ,
1796+ )
1797+ . run ( ) ;
1798+ }
16891799#[ cargo_test]
16901800fn credentials_ambiguous_filename ( ) {
16911801 // `publish` generally requires a remote registry
0 commit comments