about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/rustc.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-11-07 18:34:40 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-11-17 23:40:00 +0000
commita5b4d458a12218b2bbbcb42887d1fe1468f1986e (patch)
treede10e97ff54c191c8c442423b6f0756632698e9b /compiler/rustc_pattern_analysis/src/rustc.rs
parent6dc79f6133d24100cecbcb24e256b9f149d2b47a (diff)
downloadrust-a5b4d458a12218b2bbbcb42887d1fe1468f1986e.tar.gz
rust-a5b4d458a12218b2bbbcb42887d1fe1468f1986e.zip
Point at const when intended binding fall-through pattern is a const
```
error[E0004]: non-exhaustive patterns: `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
  --> $DIR/intended-binding-pattern-is-const.rs:2:11
   |
LL |     match 1 {
   |           ^ patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
LL |         x => {}
   |         - this pattern doesn't introduce a new catch-all binding, but rather pattern matches against the value of constant `x`
   |
   = note: the matched value is of type `i32`
note: constant `x` defined here
  --> $DIR/intended-binding-pattern-is-const.rs:7:5
   |
LL |     const x: i32 = 4;
   |     ^^^^^^^^^^^^
help: if you meant to introduce a binding, use a different name
   |
LL |         x_var => {}
   |          ++++
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
   |
LL |         x => {}, i32::MIN..=3_i32 | 5_i32..=i32::MAX => todo!()
   |                ++++++++++++++++++++++++++++++++++++++++++++++++
```
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/rustc.rs')
0 files changed, 0 insertions, 0 deletions