@@ -46,14 +46,14 @@ possibilities:
46
46
# Current configuration will continue to work
47
47
foo = []
48
48
# 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!" } }
53
53
54
54
# Features can also be full tables if descriptions are longer
55
55
[features .corge ]
56
- requires = [" bar" , " baz" ]
56
+ enables = [" bar" , " baz" ]
57
57
doc = """
58
58
# corge
59
59
@@ -63,9 +63,10 @@ This could be a longer description of this feature
63
63
64
64
The following keys would be allowed in a feature table:
65
65
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"] }`
69
70
- ` doc ` : A markdown docstring describing the feature. Like with ` #[doc(...)] ` ,
70
71
the first line will be treated as a summary.
71
72
- ` 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
93
94
straightforward. Each of the added keys is discussed individually in the
94
95
following sections:
95
96
96
- ## ` requires `
97
+ ## ` enables `
97
98
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
99
100
exists. Semantics will remain unchanged.
100
101
101
102
This is a required key. If there are no requirements, an empty list should be
102
- provided (` requires = []` ).
103
+ provided (` enables = []` ).
103
104
104
105
## ` doc `
105
106
@@ -156,7 +157,7 @@ crates.
156
157
157
158
The default ` true ` is not consistent with [ ` public_private_dependencies ` ] or
158
159
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
160
161
return the same result.
161
162
162
163
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
269
270
270
271
``` toml
271
272
[features ]
272
- foo = { requires = [], doc = " foo feature" }
273
+ foo = { enables = [], doc = " foo feature" }
273
274
# # foo feature
274
275
foo = []
275
276
```
@@ -307,7 +308,7 @@ ignore this key, newer Cargo would be able to merge `features`, `features2`, and
307
308
implementation, the challenges of supporting markdown are better understood.
308
309
309
310
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
311
312
could be added over time.
312
313
313
314
# Future possibilities
@@ -343,8 +344,8 @@ could be added over time.
343
344
features requiring long descriptions.
344
345
345
346
```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" }
348
349
```
349
350
350
351
[cargo #12335 ]: https://github.com/rust-lang/cargo/issues/12235
0 commit comments