-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo fix: Prevent fixing in mixed up transition steps #5778
Comments
cc @killercup |
Wanted to share anecdotal support for this feature. When I was doing a transition of a crate, it was very natural to up-arrow in the terminal and pull down my first |
Yes currently I'm not sure if we've got the best ergonomics. Another option would be to issue a warning and keep going (without the lint group), but that runs more risk of causing hundreds of errors I think than the annoyance of tweaking arguments. |
Yeah, I feel like shooting for a "fail-fast" error in this case with a good message would be the best IMO. |
This commit adds two diagnostics in particular to ease the transition into the 2018 edition. The current transition process is pretty particular and must be done carefully, so let's try to automate things to make it as painless as possible! Notably the new diagnostics are: * If you `cargo fix --prepare-for 2018` a crate which already has the 2018 edition enabled, then an error is generated. This is because the compiler can't prepare for the 2018 edition if you're already in the 2018 edition, the lints won't have a chance to fire. You can only execute `--prepare-for 2018` over crates in the 2015 edition. * If you `cargo fix --prepare-for 2018` and have forgotten the `rust_2018_preview` feature, a warning is issued. The lints don't fire unless the feature is enabled, so this is intended to warn in this situation to ensure that lints fire as much as they can. After this commit if `cargo fix --prepare-for` exits successfully with zero warnings then crates should be guaranteed to be compatible! Closes rust-lang#5778
Add more diagnostics to smooth edition transition This commit adds two diagnostics in particular to ease the transition into the 2018 edition. The current transition process is pretty particular and must be done carefully, so let's try to automate things to make it as painless as possible! Notably the new diagnostics are: * If you `cargo fix --prepare-for 2018` a crate which already has the 2018 edition enabled, then an error is generated. This is because the compiler can't prepare for the 2018 edition if you're already in the 2018 edition, the lints won't have a chance to fire. You can only execute `--prepare-for 2018` over crates in the 2015 edition. * If you `cargo fix --prepare-for 2018` and have forgotten the `rust_2018_preview` feature, a warning is issued. The lints don't fire unless the feature is enabled, so this is intended to warn in this situation to ensure that lints fire as much as they can. After this commit if `cargo fix --prepare-for` exits successfully with zero warnings then crates should be guaranteed to be compatible! Closes #5778
A common problem we're seeing in the 2018 transition is that steps are performed out of order, rendering
cargo fix
not too useful any more! I think we should implement two important fixes incargo fix
to remedy the situation:-p
arguments on the command line.--prepare-for
is passed, then an error is generated. You can't prepare for an edition if you're already in the 2018 edition!#![feature(rust_2018_preview)]
inside it then we should either warn or fail compilation.This should hopefully fix the bugs of "you enabled the edition too early" or "you forgot to enable the feature gate"!
The text was updated successfully, but these errors were encountered: