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

"inclusive range with no end" error when forgetting a space #107420

Closed
mejrs opened this issue Jan 28, 2023 · 0 comments · Fixed by #107425
Closed

"inclusive range with no end" error when forgetting a space #107420

mejrs opened this issue Jan 28, 2023 · 0 comments · Fixed by #107425
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mejrs
Copy link
Contributor

mejrs commented Jan 28, 2023

Code

fn main(){
    let x = 42;
    match x{
        0..=73 => {}
        74..=> {},
    }
}

Current output

error[E0586]: inclusive range with no end
 --> src/main.rs:5:11
  |
5 |         74..=> {},
  |           ^^^ help: use `..` instead
  |
  = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)

error: expected one of `=>`, `if`, or `|`, found `>`
 --> src/main.rs:5:14
  |
5 |         74..=> {},
  |              ^ expected one of `=>`, `if`, or `|`

For more information about this error, try `rustc --explain E0586`.
error: could not compile `playground` due to 2 previous errors

Desired output

It should suggest inserting a space:

-        74..=> {},
+        74.. => {},

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

@mejrs mejrs added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 28, 2023
@bors bors closed this as completed in 4e8f7e4 Jan 29, 2023
kevinmehall added a commit to kevinmehall/rust-peg that referenced this issue Apr 21, 2024
After removing the brackets, we still want a group with delimiter None.
Because the `spacing` of the last token of the pattern is passed
through, it can conflict with the following `=` in the expansion and
cause an error like rust-lang/rust#107420
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 T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant