rust/src/test/ui/numeric
Yuki Okushi ebd31f5f1a
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.
2021-09-19 17:31:29 +09:00
..
const-scope.rs
const-scope.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
len.rs
len.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
numeric-cast-2.rs
numeric-cast-2.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
numeric-cast-binop.fixed fixup! Provide suggestion to convert numeric op LHS rather than unwrapping RHS 2020-06-11 09:04:27 -07:00
numeric-cast-binop.rs fixup! Provide suggestion to convert numeric op LHS rather than unwrapping RHS 2020-06-11 09:04:27 -07:00
numeric-cast-binop.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
numeric-cast-no-fix.rs fixup! Note numeric literals that can never fit in an expected type 2020-06-16 06:55:24 -07:00
numeric-cast-no-fix.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
numeric-cast-without-suggestion.rs
numeric-cast-without-suggestion.stderr
numeric-cast.fixed Fix numeric-cast tests for new into suggestion 2020-04-28 21:40:03 +05:30
numeric-cast.rs
numeric-cast.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
numeric-fields.rs
numeric-fields.stderr Suggest replacing an inexisting field for an unmentioned field 2021-09-13 21:16:05 +09:00
numeric-suffix.fixed
numeric-suffix.rs
numeric-suffix.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00