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

Check for missing space between fat arrow and range pattern #107425

Merged
merged 2 commits into from
Jan 29, 2023

Conversation

clubby789
Copy link
Contributor

Fixes #107420

Ideally we wouldn't emit an error about expecting => etc., but I'm not sure how to recover from this.

@rustbot label +A-diagnostics

@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2023

r? @lcnr

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints labels Jan 28, 2023
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Looks good to me. Minor tweaks, then I can approve.

compiler/rustc_parse/src/parser/pat.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member

r? @compiler-errors

@rustbot rustbot assigned compiler-errors and unassigned lcnr Jan 28, 2023
@rustbot rustbot added the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Jan 28, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2023

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Wonderful, thanks

@compiler-errors
Copy link
Member

@clubby789 can you fix the errors?

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 29, 2023

📌 Commit c568879 has been approved by compiler-errors

It is now in the queue for this repository.

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 29, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 29, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#106618 (Disable `linux_ext` in wasm32 and fortanix rustdoc builds.)
 - rust-lang#107097 (Fix def-use dominance check)
 - rust-lang#107154 (library/std/sys_common: Define MIN_ALIGN for m68k-unknown-linux-gnu)
 - rust-lang#107397 (Gracefully exit if --keep-stage flag is used on a clean source tree)
 - rust-lang#107401 (remove the usize field from CandidateSource::AliasBound)
 - rust-lang#107413 (make more pleasant to read)
 - rust-lang#107422 (Also erase substs for new infcx in pin move error)
 - rust-lang#107425 (Check for missing space between fat arrow and range pattern)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4e8f7e4 into rust-lang:master Jan 29, 2023
@rustbot rustbot added this to the 1.69.0 milestone Jan 29, 2023
@@ -0,0 +1,19 @@
error: unexpected `=>` after open range
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have preferred more elaboration in this message. Right now the suggestion helps the user, but it doesn't teach the user what the problem actually was (this was parsed as InclusiveRangeStart(74) > and not ExclusiveRangeStart(74) =>.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I agree that this message is confusing now that I look at it.

It honestly could've probably just been left as the old primary, like "unexpected > after inclusive range", perhaps with a label saying something like:

 --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:11
   |
LL |         74..=> {},
   |           ^^^ This is parsed as an inclusive range `..=`

@clubby789, would you like to follow up on this message?

compiler-errors added a commit to compiler-errors/rust that referenced this pull request Feb 2, 2023
…, r=estebank

Improve diagnostic for missing space in range pattern

Improves the diagnostic in rust-lang#107425 by turning it into a note explaining the parsing issue.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 2, 2023
…, r=estebank

Improve diagnostic for missing space in range pattern

Improves the diagnostic in rust-lang#107425 by turning it into a note explaining the parsing issue.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 2, 2023
…, r=estebank

Improve diagnostic for missing space in range pattern

Improves the diagnostic in rust-lang#107425 by turning it into a note explaining the parsing issue.

r? `@compiler-errors`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"inclusive range with no end" error when forgetting a space
6 participants