9

Unify weak and namespaced features. by ehuss · Pull Request #9574 · rust-lang/ca...

 3 years ago
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.
neoserver,ios ssh client

Copy link

Contributor

ehuss commented 20 days ago

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.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK