Syntax: Recover on for ( $pat in $expr ) $block#62928
Merged
bors merged 3 commits intorust-lang:masterfrom Jul 30, 2019
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
731cd32 to
ee903d4
Compare
ee903d4 to
56b39fb
Compare
Contributor
Author
Contributor
|
I'll take a look at it later today. |
estebank
reviewed
Jul 29, 2019
| | --------------^ | ||
| | | | ||
| | opening `(` | ||
| | help: remove parenthesis in `for` loop: `elem in vec` |
Contributor
There was a problem hiding this comment.
I'm not entirely happy with the wording:
- The span pointing at the opening brace is slightly redundant.
- The issue is already known to be the superfluous parenthesis, so it thee maim message could be
incorrect parenthesis surrounding for heador similar (probably something more user friendly). - The primary span points at the closing parenthesis but it doesn't have a label.
- Suggestions that have very subtle changes sometimes make people not pay attention to the text, in this case people might not realize the lack of parenthesis in the suggested code.
- We have two errors pointing at the problem here (the prior "
innot expected" error, but it's ok emitting both for now)
IMO something like the following would be better:
error: unnecessary parenthesis surroundinig `for` loop head
--> $DIR/recover-for-loop-parens-around-head.rs:10:23
|
LL | for ( elem in vec ) {
| ^ ^ help: remove these surrounding parenthesis
Contributor
Collaborator
|
📌 Commit 56b39fb has been approved by |
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jul 29, 2019
…ead, r=estebank Syntax: Recover on `for ( $pat in $expr ) $block` Fixes rust-lang#62724 by adding some recovery: ``` error: unexpected closing `)` --> $DIR/recover-for-loop-parens-around-head.rs:10:23 | LL | for ( elem in vec ) { | --------------^ | | | opening `(` | help: remove parenthesis in `for` loop: `elem in vec` ``` The last 2 commits are drive-by cleanups. r? @estebank
This was referenced Jul 29, 2019
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jul 29, 2019
…ead, r=estebank Syntax: Recover on `for ( $pat in $expr ) $block` Fixes rust-lang#62724 by adding some recovery: ``` error: unexpected closing `)` --> $DIR/recover-for-loop-parens-around-head.rs:10:23 | LL | for ( elem in vec ) { | --------------^ | | | opening `(` | help: remove parenthesis in `for` loop: `elem in vec` ``` The last 2 commits are drive-by cleanups. r? @estebank
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jul 30, 2019
…ead, r=estebank Syntax: Recover on `for ( $pat in $expr ) $block` Fixes rust-lang#62724 by adding some recovery: ``` error: unexpected closing `)` --> $DIR/recover-for-loop-parens-around-head.rs:10:23 | LL | for ( elem in vec ) { | --------------^ | | | opening `(` | help: remove parenthesis in `for` loop: `elem in vec` ``` The last 2 commits are drive-by cleanups. r? @estebank
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jul 30, 2019
…ead, r=estebank Syntax: Recover on `for ( $pat in $expr ) $block` Fixes rust-lang#62724 by adding some recovery: ``` error: unexpected closing `)` --> $DIR/recover-for-loop-parens-around-head.rs:10:23 | LL | for ( elem in vec ) { | --------------^ | | | opening `(` | help: remove parenthesis in `for` loop: `elem in vec` ``` The last 2 commits are drive-by cleanups. r? @estebank
bors
added a commit
that referenced
this pull request
Jul 30, 2019
Rollup of 12 pull requests Successful merges: - #61965 (Remove mentions of removed `offset_to` method from `align_offset` docs) - #62928 (Syntax: Recover on `for ( $pat in $expr ) $block`) - #63000 (Impl Debug for Chars) - #63083 (Make generic parameters always use modern hygiene) - #63087 (Add very simple edition check to tidy.) - #63093 (Properly check the defining scope of existential types) - #63096 (Add tests for some `existential_type` ICEs) - #63099 (vxworks: Remove Linux-specific comments.) - #63106 (ci: Skip installing SWIG/xz on OSX ) - #63108 (Add links to None in Option doc) - #63109 (std: Fix a failing `fs` test on Windows) - #63111 (Add syntactic and semantic tests for rest patterns, i.e. `..`) 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.
Fixes #62724 by adding some recovery:
The last 2 commits are drive-by cleanups.
r? @estebank