Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for feature-metadata #14157

Open
epage opened this issue Jun 27, 2024 · 9 comments
Open

Tracking Issue for feature-metadata #14157

epage opened this issue Jun 27, 2024 · 9 comments
Labels
A-features Area: features — conditional compilation A-manifest Area: Cargo.toml issues C-tracking-issue Category: A tracking issue for something unstable. S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review

Comments

@epage
Copy link
Contributor

epage commented Jun 27, 2024

Summary

RFC: #3416
Implementation: #NNNN
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#feature-metadata

Extend the schema for feature activations to be a table, not just an array, so more fields can be added in the future.

Unresolved Issues

No response

Future Extensions

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

@epage epage added the C-tracking-issue Category: A tracking issue for something unstable. label Jun 27, 2024
@weihanglo weihanglo added the S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review label Jun 28, 2024
@epage epage added A-features Area: features — conditional compilation A-manifest Area: Cargo.toml issues labels Jul 8, 2024
@amab8901
Copy link

The docs link u posted (https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#feature-metadata) seems obsolete since there is no section called feature-metadata in that page

@weihanglo
Copy link
Member

@amab8901 it is just a placeholder because it hasn't yet implemented

@amab8901
Copy link

I think I found the place in the cargo source code that needs to be changed to implement this feature:
image

The Vec<String> should probably be replaced with BTreeMap<String,String>. At least that's my first thought. But then I realize it will prob break the old syntax. So now I'm thinking maybe we need some kind of generic? Or perhaps some kind of match statement to deal with Vec vs BTreeMap separately?

@epage
Copy link
Contributor Author

epage commented Aug 25, 2024

That section of code is an internal data structure to track cargo adds command-line. Cargo.tomls definition is in crates/cargo-util-schemas. An untagged enum would need to be used, much like we have "simple" and "detailed" dependencies. All of this would need to be behind an unstable feature as mentioned behind our contributor guide. We'd also need to make sure that people not using this syntax aren't switched to it on cargo publish so we don't force everyone to upgrade cargo.

With all that said, I'm unsure how much benefit there is on moving this forward until we have fields to take advantage of it.

@amab8901
Copy link

do u have an RFC for the fields that we are waiting for?

@weihanglo
Copy link
Member

See future extensions in the PR description.

@amab8901
Copy link

amab8901 commented Aug 25, 2024

My understanding is that you first need to solve this RFC before you can add those fields. Otherwise, when you try to add those fields, the compiler will complain and say "this is invalid syntax in Cargo.toml !"

@tgross35
Copy link

tgross35 commented Aug 25, 2024

If you are looking to put up a PR, I think the thing that could be changed now is to add a new unstable feature that allows parsing the alternate syntax for feature dependencies:

[features]
foo = []
bar = ["foo"]
# This should be the same as the above
bar = { enables = ["foo"] }

This was accepted with RFC3416. The other attributes (e.g. doc) can't yet be added since they haven't yet been accepted, but it will be easy to expand to them once this groundwork is in.

@epage
Copy link
Contributor Author

epage commented Aug 26, 2024

This was accepted with RFC3416. The other attributes (e.g. doc) can't yet be added since they haven't yet been accepted, but it will be easy to expand to them once this groundwork is in.

Note that I said

With all that said, I'm unsure how much benefit there is on moving this forward until we have fields to take advantage of it.

The important thing for the other RFCs was metadata RFC being approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-features Area: features — conditional compilation A-manifest Area: Cargo.toml issues C-tracking-issue Category: A tracking issue for something unstable. S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review
Projects
Status: No status
Development

No branches or pull requests

4 participants