diff options
| author | Hirochika Matsumoto <git@hkmatsumoto.com> | 2021-08-12 19:10:44 +0900 |
|---|---|---|
| committer | Hirochika Matsumoto <git@hkmatsumoto.com> | 2021-09-13 21:16:05 +0900 |
| commit | 37196e36918536de06e64bd2a08b9e5fcab898fa (patch) | |
| tree | e04c15c2f5d19a0b5ee9ce021d6580496dcb129e /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | c6f32f3750987640d11a97e503f57b637fd968fd (diff) | |
| download | rust-37196e36918536de06e64bd2a08b9e5fcab898fa.tar.gz rust-37196e36918536de06e64bd2a08b9e5fcab898fa.zip | |
Suggest replacing an inexisting field for an unmentioned field
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
