

Unify weak and namespaced features. by ehuss · Pull Request #9574 · rust-lang/ca...
source link: https://github.com/rust-lang/cargo/pull/9574
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

This unifies weak and namespaced features in order to simplify the syntax and semantics. Previously there were four different ways to specify the feature of a dependency:
package-name/feature-name
— Enables featurepackage-name
on self and enablesfeature-name
on the dependency. (Today's behavior.)package-name?/feature-name
— Only enablesfeature-name
on the given package if it that package is enabled and will also activates a feature namedpackage-name
(which must be defined implicitly or explicitly).dep:package-name/feature-name
— Enables dependencypackage-name
, and enablesfeature-name
on that dependency. This does NOT enable a feature named "package-name".dep:package-name?/feature-name
— Only enablesfeature-name
on the given package if it that package is enabled. This does NOT enable a feature named "package-name".
This changes it so there are only two:
package-name/feature-name
— Today's behavior.package-name?/feature-name
— Only enablesfeature-name
on the given package if it that package is enabled. This does NOT enable a feature named "package-name" (the same behavior asdep:package-name?/feature-name
above).
This is a fairly subtle change, and in most cases probably won't be noticed. However, it simplifies things which helps with writing documentation and explaining how it works.
Recommend
-
11
Member alexcrichton ...
-
10
Add some extra help to `cargo new` and invalid package names. #9098
-
16
Copy link Contributor Author ehuss...
-
15
Copy link Contributor ehuss commented
-
13
Copy link Member jtgeibel commented
-
13
Copy link Contributor ehuss
-
8
Copy link Contributor ehuss commented...
-
8
Copy link Contributor Author ehuss comme...
-
6
Contributor
-
4
Contributor ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK