]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/intersection-patterns-2.rs
Rollup merge of #104672 - Voultapher:unify-sort-modules, r=thomcc
[rust.git] / tests / ui / parser / intersection-patterns-2.rs
1 // This tests the parser recovery in `recover_intersection_pat`
2 // and serves as a regression test for the diagnostics issue #65400.
3 //
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.
8
9 fn main() {
10     let s: Option<u8> = None;
11
12     match s {
13         Some(x) @ Some(y) => {}
14         //~^ ERROR left-hand side of `@` must be a binding
15         //~| interpreted as a pattern, not a binding
16         //~| also a pattern
17         //~| NOTE bindings are `x`, `mut x`, `ref x`, and `ref mut x`
18         _ => {}
19     }
20 }