@@ -1687,9 +1687,26 @@ repository = "foo"
1687
1687
}
1688
1688
1689
1689
#[ cargo_test]
1690
- fn publish_feature_point_to_stripped_dep ( ) {
1690
+ fn publish_with_feature_point_diff_kinds_dep ( ) {
1691
1691
let registry = RegistryBuilder :: new ( ) . http_api ( ) . http_index ( ) . build ( ) ;
1692
-
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 ( ) ;
1693
1710
let p = project ( )
1694
1711
. file (
1695
1712
"Cargo.toml" ,
@@ -1707,11 +1724,38 @@ fn publish_feature_point_to_stripped_dep() {
1707
1724
1708
1725
1709
1726
[features]
1710
- foo_feature = ["bar/cat"]
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 = "../bar", features = ["cat"] }
1747
+ normal-and-dev = { version = "1.0", features = ["cat"] }
1711
1748
1712
- [dev-dependencies.bar]
1713
- path = "../bar"
1714
- features = ["cat"]
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 = "../bar", features = ["cat"] }
1758
+ target-normal-and-dev = { version = "1.0", features = ["cat"] }
1715
1759
"# ,
1716
1760
)
1717
1761
. file ( "src/main.rs" , "" )
@@ -1738,72 +1782,20 @@ fn publish_feature_point_to_stripped_dep() {
1738
1782
. build ( ) ;
1739
1783
1740
1784
p. cargo ( "publish --no-verify" )
1785
+ . env ( "RUSTFLAGS" , "--cfg unix" )
1741
1786
. replace_crates_io ( registry. index_url ( ) )
1787
+ . with_status ( 101 )
1742
1788
. with_stderr (
1743
1789
"\
1744
1790
[UPDATING] [..]
1745
1791
[PACKAGING] foo v0.1.0 [..]
1746
- [PACKAGED] [..] files, [..] ([..] compressed)
1747
- [UPLOADING] foo v0.1.0 [..]
1748
- [UPLOADED] foo v0.1.0 [..]
1749
- [NOTE] waiting [..]
1750
- You may press ctrl-c [..]
1751
- [PUBLISHED] foo v0.1.0 [..]
1792
+ [ERROR] failed to prepare local package [..]
1793
+
1794
+ Caused by:
1795
+ feature `foo_feature` includes `target-dev-only/cat`, but `target-dev-only` is not a dependency
1752
1796
" ,
1753
1797
)
1754
1798
. run ( ) ;
1755
-
1756
- publish:: validate_upload_with_contents (
1757
- r#"
1758
- {
1759
- "authors": [],
1760
- "badges": {},
1761
- "categories": [],
1762
- "deps": [],
1763
- "description": "foo",
1764
- "documentation": "foo",
1765
- "features": {
1766
- "foo_feature": []
1767
- },
1768
- "homepage": "foo",
1769
- "keywords": [],
1770
- "license": "MIT",
1771
- "license_file": null,
1772
- "links": null,
1773
- "name": "foo",
1774
- "readme": null,
1775
- "readme_file": null,
1776
- "repository": "foo",
1777
- "rust_version": null,
1778
- "vers": "0.1.0"
1779
- }
1780
- "# ,
1781
- "foo-0.1.0.crate" ,
1782
- & [ "Cargo.lock" , "Cargo.toml" , "Cargo.toml.orig" , "src/main.rs" ] ,
1783
- & [ (
1784
- "Cargo.toml" ,
1785
- & format ! (
1786
- r#"{}
1787
- [package]
1788
- edition = "2015"
1789
- name = "foo"
1790
- version = "0.1.0"
1791
- authors = []
1792
- description = "foo"
1793
- homepage = "foo"
1794
- documentation = "foo"
1795
- license = "MIT"
1796
- repository = "foo"
1797
-
1798
- [dev-dependencies]
1799
-
1800
- [features]
1801
- foo_feature = []
1802
- "# ,
1803
- cargo:: core:: package:: MANIFEST_PREAMBLE
1804
- ) ,
1805
- ) ] ,
1806
- ) ;
1807
1799
}
1808
1800
#[ cargo_test]
1809
1801
fn credentials_ambiguous_filename ( ) {
0 commit comments