blob: 7d5087fa0ffae6cedace9e55dadb35d64bbe9953 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//@ run-rustfix
// Regression test for issue #143330.
// Ensure we suggest to replace only the intended coma with a bar, not all commas in the pattern.
fn main() {
struct Foo { x: i32, ch: char }
let pos = Foo { x: 2, ch: 'x' };
match pos {
// All commas here were replaced with bars.
// Foo { x: 2 | ch: ' |' } | Foo { x: 3 | ch: '@' } => (),
Foo { x: 2, ch: ',' }, Foo { x: 3, ch: '@' } => (),
//~^ ERROR unexpected `,` in pattern
//~| HELP try adding parentheses to match on a tuple...
//~| HELP ...or a vertical bar to match on alternative
_ => todo!(),
}
}
|