mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
b589f47441
If the user writes `S { ref field: name }` instead of `S { field: ref name }`, we suggest the correct code. Fix #72298.
19 lines
473 B
Rust
19 lines
473 B
Rust
// run-rustfix
|
|
struct S {
|
|
field_name: (),
|
|
}
|
|
|
|
fn main() {
|
|
match (S {field_name: ()}) {
|
|
S {ref field_name: _foo} => {} //~ ERROR expected `,`
|
|
}
|
|
match (S {field_name: ()}) {
|
|
S {mut field_name: _foo} => {} //~ ERROR expected `,`
|
|
}
|
|
match (S {field_name: ()}) {
|
|
S {ref mut field_name: _foo} => {} //~ ERROR expected `,`
|
|
}
|
|
// Verify that we recover enough to run typeck.
|
|
let _: usize = 3u8; //~ ERROR mismatched types
|
|
}
|