1 // This tests the parser recovery in `recover_intersection_pat`
2 // and serves as a regression test for the diagnostics issue #65400.
4 // The general idea is that for `$pat_lhs @ $pat_rhs` where
5 // `$pat_lhs` is not generated by `ref? mut? $ident` we want
6 // to suggest either switching the order or note that intersection
7 // patterns are not allowed.
10 let s: Option<u8> = None;
14 //~^ ERROR pattern on wrong side of `@`
15 //~| pattern on the left, should be on the right
16 //~| binding on the right, should be on the left
17 //~| HELP switch the order
18 //~| SUGGESTION y @ Some(x)
23 Some(x) @ Some(y) => {}
24 //~^ ERROR left-hand side of `@` must be a binding
25 //~| interpreted as a pattern, not a binding
27 //~| NOTE bindings are `x`, `mut x`, `ref x`, and `ref mut x`
33 //~^ ERROR pattern on wrong side of `@`
34 //~| pattern on the left, should be on the right
35 //~| binding on the right, should be on the left
36 //~| HELP switch the order
37 //~| SUGGESTION e @ 1..=5