diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-11-05 18:57:15 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-11-20 17:55:18 +0000 |
| commit | 2487765b88fd9122fcaf57dca94024d81183d272 (patch) | |
| tree | 1c8fa720dd984affe6812b88b94759740e82529d /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp | |
| parent | bfe809d93c67de03e3a84b80549927fd828ec5d0 (diff) | |
| download | rust-2487765b88fd9122fcaf57dca94024d81183d272.tar.gz rust-2487765b88fd9122fcaf57dca94024d81183d272.zip | |
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
