-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add -Zfix-edition
#15596
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
base: master
Are you sure you want to change the base?
Add -Zfix-edition
#15596
Conversation
This adds support for the "future" edition which was added to rustc in rust-lang/rust#137606. To enable support for unstable editions, this introduces a new `unstable-edition` cargo feature. The intent is that instead of having a new feature for each edition that we reuse this feature for all new editions. I don't see a particular reason we should have a separate one for each edition, and this helps a bit with scalability and simplifies some of the edition process. This also includes a change to rework `supports_compat_lint` explained in the comment.
This factors out the code to reload a workspace since I will be needing to reuse this elsewhere. There is some risk with this method not getting updated correctly in the future as new fields are added to Workspace (and it may be missing some things now), but that is an issue with the existing code.
This adds support for parsing the `-Zfix-edition` flag.
This adds the `EditionFixMode` enum to control the behavior of `cargo fix --edition`. The main intent is to provide a way to force `cargo fix` to migrate to a specific edition, instead of just going to the "next". This will be needed for `-Zfix-edition` in order to force it to use the "future" edition, which is never the "next" edition. This requires being able to serialize and deserialize this setting as it is conveyed through an environment variable to the recursive cargo invocation.
08b0aa2
to
9617f3b
Compare
[package] | ||
name = "foo" | ||
edition = "future" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell, is the trailing whitespace on this line intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's just an artifact of how the str!
macro works (which handles automatic updates). There isn't a blank line here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be the same answer, but just in case it was ambiguous, what stood out here wasn't the blank line, but that (unlike the blank lines above) the line contains 12 space characters (
).
This adds the implementation for the behavior of `cargo fix -Zfix-edition`.
☔ The latest upstream changes (possibly f19321e) made this pull request unmergeable. Please resolve the merge conflicts. |
This adds a new
cargo fix -Zfix-edition
permanently unstable flag to assist with edition migration testing, particularly with crater.The commits and given documentation should explain how it works, but there will be forthcoming edition documentation (on the forge) once all the pieces with crater come together.
Warning
Draft as this is stacked on top of #15595