Skip to content

Opportunity to improve error message for mistyped inclusive range (..==) #86395

@timClicks

Description

@timClicks

Given the following code: [playground link]

fn main() { println!("{:?}", 0 ..== 1) }

The current output is:

 Compiling playground v0.0.1 (/playground) error[E0586]: inclusive range with no end --> src/main.rs:2:24 | 2 | println!("{:?}", 0 ..== 1) | ^^^ help: use `..` instead | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected `,`, found `=` --> src/main.rs:2:27 | 2 | println!("{:?}", 0 ..== 1) | ^ expected `,` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0586`. error: could not compile `playground` To learn more, run the command again with --verbose. 

Ideally the output should look like:

 Compiling playground v0.0.1 (/playground) error[E0XXXX]: inclusive range typo --> src/main.rs:2:24 | 2 | println!("{:?}", 0 ..== 1) | ^^^^ help: use `..=` instead | = note: inclusive ranges end with a single equals sign (`..=`) 

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.T-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