rust/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed
Esteban Küber b589f47441 Account for ref and mut in the wrong place for pattern ident renaming
If the user writes `S { ref field: name }` instead of
`S { field: ref name }`, we suggest the correct code.

Fix #72298.
2023-10-30 00:15:49 +00:00

19 lines
476 B
Rust

// run-rustfix
struct S {
field_name: (),
}
fn main() {
match (S {field_name: ()}) {
S {field_name: ref _foo} => {} //~ ERROR expected `,`
}
match (S {field_name: ()}) {
S {field_name: mut _foo} => {} //~ ERROR expected `,`
}
match (S {field_name: ()}) {
S {field_name: ref mut _foo} => {} //~ ERROR expected `,`
}
// Verify that we recover enough to run typeck.
let _: usize = 3usize; //~ ERROR mismatched types
}