diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-09-19 17:31:29 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-19 17:31:29 +0900 |
| commit | ebd31f5f1a51099038935e679b0eb92afa3364a5 (patch) | |
| tree | 174f9f867fde654d5aa2d86de89cf97f3185519b /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 3bca7230ff1ec35db25f2547cf2e83a6f450e923 (diff) | |
| parent | 37196e36918536de06e64bd2a08b9e5fcab898fa (diff) | |
| download | rust-ebd31f5f1a51099038935e679b0eb92afa3364a5.tar.gz rust-ebd31f5f1a51099038935e679b0eb92afa3364a5.zip | |
Rollup merge of #87960 - hkmatsumoto:suggest-inexisting-field-for-unmentioned-field, r=estebank
Suggest replacing an inexisting field for an unmentioned field
Fix #87938
This PR adds a suggestion to replace an inexisting field for an
unmentioned field. Given the following code:
```rust
enum Foo {
Bar { alpha: u8, bravo: u8, charlie: u8 },
}
fn foo(foo: Foo) {
match foo {
Foo::Bar {
alpha,
beta, // `bravo` miswritten as `beta` here.
charlie,
} => todo!(),
}
}
```
the compiler now emits the error messages below.
```text
error[E0026]: variant `Foo::Bar` does not have a field named `beta`
--> src/lib.rs:9:13
|
9 | beta, // `bravo` miswritten as `beta` here.
| ^^^^
| |
| variant `Foo::Bar` does not have this field
| help: `Foo::Bar` has a field named `bravo`: `bravo`
```
Note that this suggestion is available iff the number of inexisting
fields and unmentioned fields are both 1.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
