Skip to content

Writing =< instead of <= gives an error about types #111128

Closed
@TheNeikos

Description

@TheNeikos

Code

The simplest reproduction would be something like this:

fn main() {
    if 5 =< 3 {
        println("True!");
    }
}

Current output

error: expected type, found `3`
 --> src/main.rs:2:13
  |
2 |     if 5 =< 3 {
  |             ^ expected type

Desired output

error: expected type, found `3`
 --> src/main.rs:2:13
  |
2 |     if 5 =< 3 {
  |             ^ expected type
  Note: If you want to compare for less or equal instead, use `<=`
  • the `note points at the operator

Rationale and extra context

A new user might get confused about needing a type, as the error points at the number instead of the comparator.

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTT-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