rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Cargo structured syntax for feature dependencies on crates

Open joshtriplett opened this issue 1 year ago • 2 comments

This RFC extends Cargo's structured table form of features to include a deps key, to unambiguously specify packages the feature depends on without having to use the dep:foo microformat.

[features]
myfeature = { deps = ["some-crate", "another-crate"] }
# This is equivalent to `myfeature = ["dep:some-crate", "dep:another-crate"]`
# This can also be written in shorthand form:
myfeature.deps = ["some-crate", "another-crate"]

This incremental RFC was inspired by the incremental, easier-to-review RFCs currently being used for other individual pieces of the structured table format for features.

Rendered

joshtriplett avatar Jun 21 '24 03:06 joshtriplett

I like this because of previously unmentioned future possibilities: It paves the way to have documentation on features in a more parsable format than what is currently used for the document-features crate, and it could provide machine readable descriptions for the impact on stability of a given feature (when features are used in a way that alters semver guarantees, or increase the MSRV).

[edit: Comment should have been to 3416, sorry for the noise, thanks for the clarification in https://github.com/rust-lang/rfcs/pull/3663#issuecomment-2194671155]

chrysn avatar Jun 27 '24 10:06 chrysn

Note that the table syntax is independent of this and its RFC has been merged. There is a description RFC up.

epage avatar Jun 27 '24 13:06 epage

I'm going to close this for now; it sounds like there's a desire for a more thorough and comprehensive handling of the various cases of dependency syntax, rather than an incremental step here.

joshtriplett avatar Aug 15 '24 23:08 joshtriplett