Skip to content

Commit f38d7dc

Browse files
committed
Capture cargo team meeting notes and clean up
1 parent fcdb26b commit f38d7dc

File tree

1 file changed

+48
-29
lines changed

1 file changed

+48
-29
lines changed

text/3416-feature-metadata.md

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88

99
[summary]: #summary
1010

11-
This RFC is just meta tracking information for the three following RFCs:
11+
This RFC adds a "detailed" feature definition:
12+
```toml
13+
[features]
14+
# same as `foo = []`
15+
foo = { enables = [] }
16+
```
17+
18+
This is to unblock the following RFCs:
1219

1320
- [Cargo feature descriptions](https://github.com/rust-lang/rfcs/pull/3485)
1421
- [Cargo feature deprecation](https://github.com/rust-lang/rfcs/pull/3486)
@@ -68,20 +75,11 @@ features are enabled by a given feature. For example,
6875

6976
All other keys are described in their individual RFCs.
7077

71-
# Reference-level explanation
78+
## General Implementation & Usage
7279

73-
[reference-level-explanation]: #reference-level-explanation
74-
75-
`enables` will take the place of the feature dependency array that currently
76-
exists. Semantics will remain unchanged.
77-
78-
This is a required key. If there are no requirements, an empty list should be
79-
provided (`enables = []`). This content is already in the index.
80-
81-
# General Implementation & Usage
82-
83-
Use cases for this information will likely develop with time, but one of the
84-
simplest applications is for information output with `cargo add`:
80+
Use cases for these new keys will likely develop with time,
81+
but one of the simplest applications is for information output with `cargo
82+
add`:
8583

8684
```text
8785
crab@rust foobar % cargo add regex
@@ -105,17 +103,23 @@ crab@rust foobar % cargo add regex
105103
Features like `aho-corasick`, `memchr`, or `use_std` would likely be
106104
`public = false` since they aren't listed on the crate landing page.
107105

108-
## Implementation note: sort order
106+
# Reference-level explanation
107+
108+
[reference-level-explanation]: #reference-level-explanation
109+
110+
`enables` will take the place of the feature dependency array that currently
111+
exists. Semantics will remain unchanged.
109112

110-
In general, any tool that renders features (`rustdoc`, `cargo add`) should
111-
attempt to present them in the following way:
113+
This is a required key. If there are no requirements, an empty list should be
114+
provided (`enables = []`). This content is already in the index.
112115

113-
- Display default features first
114-
- Display non-default but stable features next (can be in a separate section)
115-
- Display deprecated features last (can be in a separate section)
116-
- Do not display private features unless receiving a flag saying to do so (e.g.
117-
`--document-private-items` with `rustdoc`)
118-
- If ordering is not preserved, present the features alphabetically
116+
The availability of this new syntax should not require an MSRV bump.
117+
This means we need to make sure that if you use `feature_name = []` in your `Cargo.toml`,
118+
then the published `Cargo.toml` should as well.
119+
However, we leave it as an implementation detail whether using `feature_name = { enables =[] }`
120+
requires an MSRV bump for users of your published package as we have not been
121+
actively streamlining the workflow for maintaining separate development and
122+
published MSRVs.
119123

120124
# Drawbacks
121125

@@ -128,6 +132,23 @@ attempt to present them in the following way:
128132

129133
[rationale-and-alternatives]: #rationale-and-alternatives
130134

135+
This RFC has no impact on the Index Summaries.
136+
Future RFCs will need to work with that.
137+
138+
## Naming
139+
140+
- `enables` reads better on the line than `enable`
141+
- `enables` is likely an easier word for non-native speakers than `activates`
142+
- `required` is used elsewhere to say "this should automatically be available if requirements are met"
143+
144+
## Schema
145+
146+
We could split the special feature syntax (`dep:`, etc) as distinct fields
147+
but we'd prefer trivial conversion from the "simple" schema to the "detailed" schema,
148+
like `dependencies`.
149+
However, we likely would want to prefer using new fields over adding more syntax,
150+
like with [disabling default features](https://github.com/rust-lang/cargo/issues/3126).
151+
131152
# Prior art
132153

133154
[prior-art]: #prior-art
@@ -140,12 +161,10 @@ attempt to present them in the following way:
140161

141162
[future-possibilities]: #future-possibilities
142163

143-
- A `rust-version` field that could indicate e.g. `rust-version = "nightly"` or
144-
`rust-version = "1.65"` to specify a MSRV for that feature. See:
145-
<https://github.com/rust-lang/rfcs/pull/3416#discussion_r1174478461>
146-
- `cargo add` can show the `doc` and `deprecated` summary with the listed
147-
features.
148-
- [`cargo-info`] can use this information to provide feature descriptions.
164+
- [Cargo feature descriptions](https://github.com/rust-lang/rfcs/pull/3485)
165+
- [Cargo feature deprecation](https://github.com/rust-lang/rfcs/pull/3486)
166+
- [Cargo feature visibility](https://github.com/rust-lang/rfcs/pull/3487)
167+
- [Cargo feature stability](https://github.com/rust-lang/cargo/issues/10881)
149168

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

0 commit comments

Comments
 (0)