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

Transition out weak feature syntax in an edition #10556

Open
ehuss opened this issue Apr 12, 2022 · 2 comments
Open

Transition out weak feature syntax in an edition #10556

ehuss opened this issue Apr 12, 2022 · 2 comments
Labels
A-edition-next Area: may require a breaking change over an edition A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed. T-infra Team: infrastructure

Comments

@ehuss
Copy link
Contributor

ehuss commented Apr 12, 2022

Problem

The difference between package/feature and package?/feature syntax is unfortunate as it can be a little confusing and inelegant. Ideally we would have kept the original syntax, but the ? was added to retain backwards compatibility.

Proposed Solution

It might be worth considering dropping the ? syntax in the next edition. package/feature would behave the same as the ? variant. With the use of toml_edit, it may be possible to enhance cargo fix in order to automatically update Cargo.toml to retain backwards compatibility. If the package is optional, then it would rewrite the [features] table to convert "package/feature" to "dep:package", "package/feature" (and also possibly define a feature named "package" if it doesn't already exist and dep:package isn't already used).

Notes

No response

@ehuss ehuss added A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` labels Apr 12, 2022
@epage epage added the A-edition-next Area: may require a breaking change over an edition label Feb 7, 2023
@epage epage moved this from Ideas to Accepted in Cargo Edition 2024 Planning Sep 5, 2023
@epage epage moved this from Accepted to Ideas in Cargo Edition 2024 Planning Sep 18, 2023
@epage
Copy link
Contributor

epage commented Mar 22, 2024

There was a recent zulip thread on this.

One idea brought up is to start by deprecating dep/feature syntax, likely gated by an MSRV check. One of the challenges with this is in collecting user feedback. A deprecation is a two-way door that we can leverage to raise awareness of the change to help decide if this is a direction we'd want to commit to. If we get little actionable negative feedback or if the feedback is generally positive, those could be good signals for deciding to change the dep/feature syntax meaning on a new edition.

@epage epage added T-infra Team: infrastructure S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Apr 10, 2024
@epage
Copy link
Contributor

epage commented Jun 4, 2024

I believe the issue hints at it but its easy to overlook. A subtle difference between "dep_name/feature_name" and "dep:dep_name", "dep_name?/feature_name" is that dep: is required to suppress the creation of the implicit feature.

This came up in #14010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-next Area: may require a breaking change over an edition A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed. T-infra Team: infrastructure
Projects
Development

No branches or pull requests

2 participants