diff options
| author | Michael Goulet <michael@errs.io> | 2024-11-22 21:07:38 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-22 21:07:38 -0500 |
| commit | d2fb8b5feb74960478f3270aee604c9ec92771a4 (patch) | |
| tree | d8e01f2356cbc57dec6162cfecf5537a1d760fc9 /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp | |
| parent | 5a0086f3513de1e1f86e9bbdc4dd6f5ac3326607 (diff) | |
| parent | 2487765b88fd9122fcaf57dca94024d81183d272 (diff) | |
| download | rust-d2fb8b5feb74960478f3270aee604c9ec92771a4.tar.gz rust-d2fb8b5feb74960478f3270aee604c9ec92771a4.zip | |
Rollup merge of #132658 - estebank:const-in-pattern-typo, r=Nadrieril
Detect const in pattern with typo
When writing a constant name incorrectly in a pattern, the pattern will be identified as a new binding. We look for consts in the current crate, consts that where imported in the current crate and for local `let` bindings in case someone got them confused with `const`s.
```
error: unreachable pattern
--> $DIR/const-with-typo-in-pattern-binding.rs:30:9
|
LL | GOOOD => {}
| ----- matches any value
LL |
LL | _ => {}
| ^ no value can reach this
|
help: you might have meant to pattern match against the value of similarly named constant `GOOD` instead of introducing a new catch-all binding
|
LL | GOOD => {}
| ~~~~
```
Fix #132582.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
