Skip to content
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

parser: recover on ... as a pattern, suggesting .. #70417

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

rakshith-ravi
Copy link
Contributor

Fixes #70388

My first PR to rust. So please let me know if I'm doing something wrong.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @varkor (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 26, 2020
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising. I've left some bits to tweak for now.

Please also add a test in src/test/ui/parser/issue-70388-recover-dotdotdot-rest-pat.rs which would include the typo in e.g. TupleStruct(...) and a slice pattern [x, ..., y]. Also make sure to add something like let _recovery_witness: () = 0; //~ ERROR mismatched types, which we use to check that we can reach the type checking phase of the compiler (so we show there is parser recovery).

src/librustc_parse/parser/pat.rs Outdated Show resolved Hide resolved
src/librustc_parse/parser/pat.rs Outdated Show resolved Hide resolved
src/librustc_parse/parser/pat.rs Outdated Show resolved Hide resolved
src/librustc_parse/parser/pat.rs Outdated Show resolved Hide resolved
src/librustc_parse/parser/pat.rs Outdated Show resolved Hide resolved
src/librustc_parse/parser/pat.rs Outdated Show resolved Hide resolved
src/librustc_parse/parser/pat.rs Outdated Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Mar 26, 2020

r? @Centril

@rust-highfive rust-highfive assigned Centril and unassigned varkor Mar 26, 2020
@Centril Centril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 26, 2020
@rakshith-ravi
Copy link
Contributor Author

@Centril added your suggestions. Squashed them all to a single commit as well.

Pliss review.

@Centril Centril changed the title Throw error when encountering ... instead of a .. parser: recover on ... as a pattern, suggesting .. Mar 26, 2020
@Centril
Copy link
Contributor

Centril commented Mar 26, 2020

Thanks. This looks fabulous! 💖

@bors r+

@bors
Copy link
Contributor

bors commented Mar 26, 2020

📌 Commit 73c8203 has been approved by Centril

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 26, 2020
@rakshith-ravi
Copy link
Contributor Author

Yay! Thanks a ton!

Centril added a commit to Centril/rust that referenced this pull request Mar 26, 2020
parser: recover on `...` as a pattern, suggesting `..`

Fixes rust-lang#70388

My first PR to rust. So please let me know if I'm doing something wrong.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 26, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#68004 (permit negative impls for non-auto traits)
 - rust-lang#70385 (Miri nits: comment and var name improvement)
 - rust-lang#70411 (Fix for rust-lang#62691: use the largest niche across all fields)
 - rust-lang#70417 (parser: recover on `...` as a pattern, suggesting `..`)
 - rust-lang#70424 (simplify match stmt)

Failed merges:

r? @ghost
@bors bors merged commit 37e1860 into rust-lang:master Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

diagnostic could be better whe using "..." instead of ".." when destructuring enum
5 participants