Fix span of while (let) expressions after lowering#71494
Merged
bors merged 2 commits intorust-lang:masterfrom Apr 25, 2020
Merged
Fix span of while (let) expressions after lowering#71494bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
Contributor
|
(rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
|
Seems ok as is. |
Collaborator
|
📌 Commit 898cbf2 has been approved by |
Collaborator
|
💡 This pull request was already approved, no need to approve it again.
|
Collaborator
|
📌 Commit 898cbf2 has been approved by |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 25, 2020
Rollup of 5 pull requests Successful merges: - rust-lang#71364 (Ignore -Zprofile when building compiler_builtins) - rust-lang#71494 (Fix span of while (let) expressions after lowering) - rust-lang#71517 ( Quick and dirty fix of the unused_braces lint) - rust-lang#71523 (Take a single root node in range_search) - rust-lang#71533 (Revert PR 70566 for const validation fix) Failed merges: r? @ghost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Credit goes to @alex-700 who found this while trying to fix a suggestion in Clippy.
While
if,try,forandawaitexpressions get the span of the original expression when desugared,whileloops got the span of the scrutinee, which lead to weird code, when building the suggestion, that randomly worked: https://github.com/rust-lang/rust-clippy/pull/5511/files#diff-df4e9d2bf840a5f2e3b580bef73da3bcR106-R108I'm wondering, if
DesugaringKindshould get a variantWhileLoopand instead of using the span of theast::ExprKind::Whileexpr directly, a new span withself.mark_span_with_reasonshould be used, like it is done withforloops.There was some fallout, but I think that is acceptable. If not, I need some help to find out where this can be fixed.