Add expansion to while desugar spans#88175
Conversation
|
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
|
📌 Commit 48ac8c81573c25dd73a3f6fe0ba57b089b5799fb has been approved by |
11d1e6c to
15e8b4c
Compare
|
Fix formatting @bors r=Manishearth |
|
@bors r=Manishearth |
|
📌 Commit 15e8b4c7a9c087d36c1c09bafb33d7f0ebbb0ad4 has been approved by |
This comment has been minimized.
This comment has been minimized.
|
@bors r- |
15e8b4c to
4d4a4af
Compare
This comment has been minimized.
This comment has been minimized.
4d4a4af to
aedc947
Compare
|
Tweaked some error handling to maintain test output. |
This comment has been minimized.
This comment has been minimized.
aedc947 to
4e76930
Compare
|
@rustbot ready |
|
☔ The latest upstream changes (presumably #87688) made this pull request unmergeable. Please resolve the merge conflicts. |
4e76930 to
86d8cb2
Compare
|
☔ The latest upstream changes (presumably #89328) made this pull request unmergeable. Please resolve the merge conflicts. |
86d8cb2 to
67ea84d
Compare
|
Hey @Manishearth, I'm awaiting your review since I added some changes after your first review. |
|
@bors r+ |
|
📌 Commit 67ea84d has been approved by |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (e737694): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
…earth Add expansion to while desugar spans In the same vein as rust-lang#88163, this reverts a change in Clippy behavior as a result of rust-lang#80357 (and reverts some `#[allow]`s): This changes `clippy::blocks_in_if_conditions` to not fire on `while` loops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name. The actual change here is to add a desugaring expansion to the spans when lowering a `while` loop. r? `@Manishearth`
Before this lint didn't trigger on macros. With rust-lang/rust#88175 this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was introduced. This overrides the span of expanded expressions when lowering the while loop. So if a while loop is in a macro, the expressions that it expands to are no longer marked with `ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is the correct behavior and the same that is done for `ForLoop`s. It just tripped up this lint.
…steffen Don't trigger semicolon_if_nothing_returned in expanded code Fixes #7768 Before, this lint didn't trigger on macros. With rust-lang/rust#88175 this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was introduced. This overrides the span of expanded expressions when lowering the while loop. So if a while loop is in a macro, the expressions that it expands to are no longer marked with `ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is the correct behavior and the same that is done for `ForLoop`s. It just tripped up this lint. r? `@camsteffen` changelog: [`semicolon_if_nothing_returned`]: Fix regression on macros containing while loops
In the same vein as #88163, this reverts a change in Clippy behavior as a result of #80357 (and reverts some
#[allow]s): This changesclippy::blocks_in_if_conditionsto not fire onwhileloops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name.The actual change here is to add a desugaring expansion to the spans when lowering a
whileloop.r? @Manishearth