about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/tests
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-11-06 19:46:54 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-11-17 23:39:59 +0000
commitff2f7a7a834843ea74b1e7d6511eb4ad06f43981 (patch)
tree02dbd4c88983284bfa68a5d7452f1e6262a17724 /compiler/rustc_pattern_analysis/tests
parent917a50a03931a9861c19a46f3e2a02a28f1da936 (diff)
downloadrust-ff2f7a7a834843ea74b1e7d6511eb4ad06f43981.tar.gz
rust-ff2f7a7a834843ea74b1e7d6511eb4ad06f43981.zip
Point at `const` definition when used instead of a binding in a `let` statement
After:

```
error[E0005]: refutable pattern in local binding
  --> $DIR/bad-pattern.rs:19:13
   |
LL |     const PAT: u32 = 0;
   |     -------------- missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable
...
LL |         let PAT = v1;
   |             ^^^
   |             |
   |             pattern `1_u32..=u32::MAX` not covered
   |             help: introduce a variable instead: `PAT_var`
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
   = note: the matched value is of type `u32`
```

Before:

```
error[E0005]: refutable pattern in local binding
  --> $DIR/bad-pattern.rs:19:13
   |
LL |         let PAT = v1;
   |             ^^^
   |             |
   |             pattern `1_u32..=u32::MAX` not covered
   |             missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable
   |             help: introduce a variable instead: `PAT_var`
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
   = note: the matched value is of type `u32`
```
Diffstat (limited to 'compiler/rustc_pattern_analysis/tests')
0 files changed, 0 insertions, 0 deletions