Skip to content

..i32::MIN pattern gives error mentioning "lower range bound" #149165

@theemathas

Description

@theemathas

Code

fn main() {
    match 1 {
        ..i32::MIN => {}
        _ => {}
    };
}

Current output

error[E0579]: lower range bound must be less than upper
 --> src/main.rs:3:9
  |
3 |         ..i32::MIN => {}
  |         ^^^^^^^^^^

For more information about this error, try `rustc --explain E0579`.

Desired output

Rationale and extra context

The error refers to a nonexistent "lower range bound".

This error also occurs with f64::NEG_INFINITY and '\0'

While we're at it, it would be nice if the error clearly said that this prohibition applies only to range patterns, not range expressions.

Other cases

Rust Version

Reproducible on the playground with version 1.93.0-nightly (2025-11-20 53732d5e076329a62f71)

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-patternsRelating to patterns and pattern matchingT-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