From: Dirkjan Ochtman Date: Mon, 23 Apr 2018 07:18:08 +0000 (+0200) Subject: Add some documentation about unstable namespaced-features feature X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~36^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f5a4282e0bffad9048437d3d11288fc152e33022;p=cargo.git Add some documentation about unstable namespaced-features feature --- diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index 483e5e253..ca004ccce 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -227,3 +227,30 @@ opt-level = 3 ``` Overrides can only be specified for dev and release profiles. + + +### Namespaced features +* Original issue: [#1286](https://github.com/rust-lang/cargo/issues/1286) + +Currently, it is not possible to have a feature and a dependency with the same +name in the manifest. If you set `namespaced-features` to `true`, the namespaces +for features and dependencies are separated. The effect of this is that, in the +feature requirements, dependencies have to be prefixed with `crate:`. Like this: + +```toml +[project] +namespaced-features = true + +[features] +bar = ["crate:baz", "foo"] +foo = [] + +[dependencies] +baz = { version = "0.1", optional = true } +``` + +To prevent unnecessary boilerplate from having to explicitly declare features +for each optional dependency, implicit features get created for any optional +dependencies where a feature of the same name is not defined. However, if +a feature of the same name as a dependency is defined, that feature must +include the dependency as a requirement, as `foo = ["crate:foo"]`.