-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[CRATER RUN DO NOT MERGE] crater run to evaluate effectiveness of lint for if_let_rescope #129466
[CRATER RUN DO NOT MERGE] crater run to evaluate effectiveness of lint for if_let_rescope #129466
Conversation
|
@@ -4,7 +4,7 @@ | |||
shallow = true | |||
[submodule "src/tools/cargo"] | |||
path = src/tools/cargo | |||
url = https://github.com/rust-lang/cargo.git | |||
url = https://github.com/dingxiangfei2009/cargo.git |
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.
Question: maybe this also needs to be on a separate branch?
We can inject crate-level attrs thanks to #52355:
This would satisfy one of the conditions for lint emission, which is the feature-gate. EDIT: this is a migration lint, it cannot only fire on Edition 2024. |
But I'm not sure about |
@rustbot blocked (on figuring out why |
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.
The cargo submodule change has some extra changes to it which I would not recommend including. I would suggest just cherry-picking commit b2608729b3ef3540a8020a06a3503eff9d0dbdd2 from my fork (applied to a branch from the current submodule's commit).
0a7118a
to
6aa732a
Compare
This comment has been minimized.
This comment has been minimized.
Looks like it is working locally. Shall we give it a crater run? Just cc @jieyouxu |
We could, but it has to build on the try-job. @bors try |
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
@dingxiangfei2009, it looks like your cargo branch is outdated. You'll probably need to rebase it on latest master of the cargo repo. (In general, using the tip of master of rust-lang/cargo means you are using things that haven't landed in rust-lang/rust, yet, which may lead to problems. Using the SHA of the submodule in rust-lang/rust's cargo submodule as your base can avoid that, but is more awkward to do.) |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
912b738
to
81fac33
Compare
@ehuss Thanks for the tip! I rebased this onto the new |
@bors try |
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Try build successful - checks-actions |
Finally! @jieyouxu Shall we do one more crater run? Many thanks! 🙇 |
@craterbot run start=master#f609b7e0586f81fefb3523e3e17adf779ac416be end=try#ccf408f4326a858c00dd845a64a86b16f360a801 mode=check-only |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
I think that incantation is correct since we hijacked |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
We narrow down to the 3k crates in the entire ecosystem, most of which are not The minority of them are false positives from cc @traviscross Open questions: what should we do about the brackets included in the span? I believe we should not, but maybe other parts of |
…ope-lint, r=jieyouxu Preserve brackets around if-lets and skip while-lets r? `@jieyouxu` Tracked by rust-lang#124085 Fresh out of rust-lang#129466, we have discovered 9 crates that the lint did not successfully migrate because the span of `if let` includes the surrounding brackets `(..)` like the following, which surprised me a bit. ```rust if (if let .. { .. } else { .. }) { // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // the span somehow includes the surrounding brackets } ``` There is one crate that failed the migration because some suggestion spans cross the macro expansion boundaries. Surely there is no way to patch them with `match` rewrite. To handle this case, we will instead require all spans to be tested for admissibility as suggestion spans. Besides, there are 4 false negative cases discovered with desugared-`while let`. We don't need to lint them, because the `else` branch surely contains exactly one statement because the drop order is not changed whatsoever in this case. ```rust while let Some(value) = droppy().get() { .. } // is desugared into loop { if let Some(value) = droppy().get() { .. } else { break; // here can be nothing observable in this block } } ``` I believe this is the one and only false positive that I have found. I think we have finally nailed all the corner cases this time.
Rollup merge of rust-lang#131035 - dingxiangfei2009:tweak-if-let-rescope-lint, r=jieyouxu Preserve brackets around if-lets and skip while-lets r? `@jieyouxu` Tracked by rust-lang#124085 Fresh out of rust-lang#129466, we have discovered 9 crates that the lint did not successfully migrate because the span of `if let` includes the surrounding brackets `(..)` like the following, which surprised me a bit. ```rust if (if let .. { .. } else { .. }) { // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // the span somehow includes the surrounding brackets } ``` There is one crate that failed the migration because some suggestion spans cross the macro expansion boundaries. Surely there is no way to patch them with `match` rewrite. To handle this case, we will instead require all spans to be tested for admissibility as suggestion spans. Besides, there are 4 false negative cases discovered with desugared-`while let`. We don't need to lint them, because the `else` branch surely contains exactly one statement because the drop order is not changed whatsoever in this case. ```rust while let Some(value) = droppy().get() { .. } // is desugared into loop { if let Some(value) = droppy().get() { .. } else { break; // here can be nothing observable in this block } } ``` I believe this is the one and only false positive that I have found. I think we have finally nailed all the corner cases this time.
Tracked by #124085
Related to #107251
cc @jieyouxu for review context
cc @traviscross for edition tracking
There is one unresolved issue that
cargo fix --edition
does not emitif-let-rescope
lint. Details in rust-lang/cargo#14447.Note that this patch is assuming that the feature gate
if_let_rescope
is always on just for this crater run.