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. |
||
|---|---|---|
| .. | ||
| const-scope.rs | ||
| const-scope.stderr | ||
| len.rs | ||
| len.stderr | ||
| numeric-cast-2.rs | ||
| numeric-cast-2.stderr | ||
| numeric-cast-binop.fixed | ||
| numeric-cast-binop.rs | ||
| numeric-cast-binop.stderr | ||
| numeric-cast-no-fix.rs | ||
| numeric-cast-no-fix.stderr | ||
| numeric-cast-without-suggestion.rs | ||
| numeric-cast-without-suggestion.stderr | ||
| numeric-cast.fixed | ||
| numeric-cast.rs | ||
| numeric-cast.stderr | ||
| numeric-fields.rs | ||
| numeric-fields.stderr | ||
| numeric-suffix.fixed | ||
| numeric-suffix.rs | ||
| numeric-suffix.stderr | ||