@@ -69,9 +69,10 @@ The following keys would be allowed in a feature table:
69
69
- ` doc ` : A markdown docstring describing the feature. Like with ` #[doc(...)] ` ,
70
70
the first line will be treated as a summary.
71
71
- ` deprecated ` : This can be either a simple boolean, a string, or an object
72
- with ` since ` and/or ` note ` keys. Cargo will warn downstream crates using this
72
+ with ` since ` and/or ` note ` keys. Cargo will warn downstream crates using
73
+ this feature.
73
74
- ` public ` : A boolean flag defaulting to ` true ` that indicates whether or not
74
- downstream crates should be allowed to use this feature
75
+ downstream crates should be allowed to use this feature.
75
76
76
77
If a downstream crate attempts to use the features ` baz ` and ` qux ` , they will
77
78
see messages like the following:
@@ -104,7 +105,8 @@ provided (`requires = []`).
104
105
105
106
` doc ` is the most straightforward: it accepts markdown-flavored text, and should
106
107
be thought of as the equivalent to a ` #[doc(...)] ` attribute. Like doc comments,
107
- the first line should be treated as a summary.
108
+ the first line should be treated as a summary. Intra-doc link support is not
109
+ included in this RFC, so they should not be used.
108
110
109
111
There is nothing in this RFC that cargo ` must ` do with this action, since it is
110
112
mainly intended for the consumption of ` rustdoc ` or ` docs.rs ` . However, it can
@@ -183,6 +185,12 @@ Full support does not need to happen immediately, since it will require this
183
185
information be present in the index. [ Index changes] describes how this can take
184
186
place.
185
187
188
+ Two sample use cases for ` public = false ` include:
189
+
190
+ - ` docs.rs ` having a way to know which features should be hidden
191
+ - Features that are included in feature chains (feature ` a ` enables feature
192
+ ` b ` ) but not meant for public consumption could be marked not public
193
+
186
194
# General Implementation & Usage
187
195
188
196
Use cases for this information will likely develop with time, but one of the
@@ -284,28 +292,23 @@ ignore this key, newer Cargo would be able to merge `features`, `features2`, and
284
292
start with `_`, they are hidden from this table.
285
293
- Ivy has a [visibility attribute] for its configuration (mentioned in
286
294
[cargo #10882 ])
295
+ - Discussion on stable/unstable/nightly-only features
296
+ <https://github.com/rust-lang/cargo/issues/10881>
287
297
288
298
# Unresolved questions
289
299
290
300
[unresolved-questions ]: # unresolved-questions
291
301
292
- - Do we want all the proposed keys? Specifically, `public` may be more than
293
- what is needed.
294
-
295
- See also:
296
-
297
- - <https://github.com/rust-lang/cargo/issues/10882>
298
- - <https://github.com/rust-lang/cargo/issues/10881>
299
-
300
302
- If we use the semantics as-written, should there be a
301
303
`--allow-private-features` flag? Or how should a user opt in?
302
- - Does it make sense to have separate `hidden` (not documented) and `public`
303
- (feature not allowed downstream) attribute? I think probably not
304
- - The Cargo index may need a way to be aware of deprecated features, so it can
305
- properly report them during resolution. What would be needed here?
306
-
307
- It is worth noting that simpler keys (`requires`, `doc`, `deprecated`) could be
308
- stabilized immediately and other features could be postponed.
304
+ - Rather than being consistent with `rustdoc` and accepting markdown, should
305
+ the `doc` key be consistent with `package.description` and only support
306
+ plain text? This RFC proposes making this decision at time of
307
+ implementation, the challenges of supporting markdown are better understood.
308
+
309
+ 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
+ could be added over time.
309
312
310
313
# Future possibilities
311
314
0 commit comments