rust/src/test/ui/numeric
Hirochika Matsumoto 37196e3691 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.
2021-09-13 21:16:05 +09:00
..
const-scope.rs Account for const fns to avoid incorrect suggestions 2019-04-29 17:14:31 -07:00
const-scope.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
len.rs Add test 2019-04-29 14:38:26 -07:00
len.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
numeric-cast-2.rs
numeric-cast-2.stderr Modify structured suggestion output 2021-08-11 09:46:24 +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 Modify structured suggestion output 2021-08-11 09:46:24 +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 Modify structured suggestion output 2021-08-11 09:46:24 +00:00
numeric-cast-without-suggestion.rs Suggest try_into when possible 2019-04-29 14:38:26 -07:00
numeric-cast-without-suggestion.stderr Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
numeric-cast.fixed Fix numeric-cast tests for new into suggestion 2020-04-28 21:40:03 +05:30
numeric-cast.rs Suggest try_into when possible 2019-04-29 14:38:26 -07:00
numeric-cast.stderr Modify structured suggestion output 2021-08-11 09:46:24 +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 Suggest try_into when possible 2019-04-29 14:38:26 -07:00
numeric-suffix.rs Suggest try_into when possible 2019-04-29 14:38:26 -07:00
numeric-suffix.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00