]> git.proxmox.com Git - cargo.git/commit
Auto merge of #9574 - ehuss:weak-namespaced, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 22 Jun 2021 21:02:31 +0000 (21:02 +0000)
committerbors <bors@rust-lang.org>
Tue, 22 Jun 2021 21:02:31 +0000 (21:02 +0000)
commita2589dda38d0c158e3945371445e9ff75065f587
treeb157c71e00f3c6acbd92aabb31a5bee549f331cd
parent32238b474797da5b6730840219e4a487d73f2f72
parent9034e488ff67dd09f088c279fc7d3ea396f41273
Auto merge of #9574 - ehuss:weak-namespaced, r=alexcrichton

Unify weak and namespaced features.

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 feature `package-name` on self and enables `feature-name` on the dependency. (Today's behavior.)
* `package-name?/feature-name` — Only enables `feature-name` on the given package if it that package is enabled and will also activates a feature named `package-name` (which must be defined implicitly or explicitly).
* `dep:package-name/feature-name` — Enables dependency `package-name`, and enables `feature-name` on that dependency. This does NOT enable a feature named "package-name".
* `dep:package-name?/feature-name` — Only enables `feature-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 enables `feature-name` on the given package if it that package is enabled.  This does NOT enable a feature named "package-name" (the same behavior as `dep: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.
tests/testsuite/features_namespaced.rs
tests/testsuite/weak_dep_features.rs