Skip to content

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

Closed
@mejrs

Description

@mejrs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions