Skip to content

Commit 397d47e

Browse files
committed
Rename 'requires' to 'enables'
1 parent e36b155 commit 397d47e

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

text/0000-feature-metadata.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ possibilities:
4646
# Current configuration will continue to work
4747
foo = []
4848
# New configurations
49-
bar = { requires = ["foo"], doc = "simple docstring here"}
50-
baz = { requires = ["foo"], public = false}
51-
qux = { requires = [], deprecated = true }
52-
quux = { requires = [], deprecated = { since = "1.2.3", note = "don't use this!" } }
49+
bar = { enables = ["foo"], doc = "simple docstring here"}
50+
baz = { enables = ["foo"], public = false}
51+
qux = { enables = [], deprecated = true }
52+
quux = { enables = [], deprecated = { since = "1.2.3", note = "don't use this!" } }
5353

5454
# Features can also be full tables if descriptions are longer
5555
[features.corge]
56-
requires = ["bar", "baz"]
56+
enables = ["bar", "baz"]
5757
doc = """
5858
# corge
5959
@@ -63,9 +63,10 @@ This could be a longer description of this feature
6363

6464
The following keys would be allowed in a feature table:
6565

66-
- `requires`: This is synonymous with the existing array describing required
67-
features. For example, `foo = ["dep:serde", "otherfeat"]` will be identical to
68-
`foo = { requires = ["dep:serde", "otherfeat"] }`
66+
- `enables`: This is synonymous with the existing array describing what
67+
features are enabled by the described feature features. For example, `foo =
68+
["dep:serde", "otherfeat"]` will be identical to `foo = { enables =
69+
["dep:serde", "otherfeat"] }`
6970
- `doc`: A markdown docstring describing the feature. Like with `#[doc(...)]`,
7071
the first line will be treated as a summary.
7172
- `deprecated`: This can be either a simple boolean, a string, or an object
@@ -93,13 +94,13 @@ Validation and parsing of the new schema, described above, shoud be relatively
9394
straightforward. Each of the added keys is discussed individually in the
9495
following sections:
9596

96-
## `requires`
97+
## `enables`
9798

98-
`requires` will take the place of the feature dependency array that currently
99+
`enables` will take the place of the feature dependency array that currently
99100
exists. Semantics will remain unchanged.
100101

101102
This is a required key. If there are no requirements, an empty list should be
102-
provided (`requires = []`).
103+
provided (`enables = []`).
103104

104105
## `doc`
105106

@@ -156,7 +157,7 @@ crates.
156157

157158
The default `true` is not consistent with [`public_private_dependencies`] or
158159
Rust's `pub`, but is a reasonable default to be consistent with the current
159-
behavior so that either `feature = []` or `feature = { "requires" = [] }` will
160+
behavior so that either `feature = []` or `feature = { "enables" = [] }` will
160161
return the same result.
161162

162163
The name `public` was chosen in favor of `pub` to be consistent with the
@@ -269,7 +270,7 @@ ignore this key, newer Cargo would be able to merge `features`, `features2`, and
269270

270271
```toml
271272
[features]
272-
foo = { requires = [], doc = "foo feature" }
273+
foo = { enables = [], doc = "foo feature" }
273274
## foo feature
274275
foo = []
275276
```
@@ -307,7 +308,7 @@ ignore this key, newer Cargo would be able to merge `features`, `features2`, and
307308
implementation, the challenges of supporting markdown are better understood.
308309

309310
It is worth noting that not all of these feature flags need to be made available
310-
at once. `requires` needs to be implemented first, but support for all others
311+
at once. `enables` needs to be implemented first, but support for all others
311312
could be added over time.
312313

313314
# Future possibilities
@@ -343,8 +344,8 @@ could be added over time.
343344
features requiring long descriptions.
344345

345346
```toml
346-
foo = { requires = [], doc-file = "features.md#foo" }
347-
bar = { requires = [], doc-file = "features.md#bar" }
347+
foo = { enables = [], doc-file = "features.md#foo" }
348+
bar = { enables = [], doc-file = "features.md#bar" }
348349
```
349350

350351
[cargo #12335]: https://github.com/rust-lang/cargo/issues/12235

0 commit comments

Comments
 (0)