fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.0 KiB35 linesraw
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// run-rustfix
10
11#![allow(unused_variables)]
12
13fn main() {
14    let s: Option<u8> = None;
15
16    match s {
17        y @ Some(x) => {}
18        //~^ ERROR pattern on wrong side of `@`
19        //~| pattern on the left, should be on the right
20        //~| binding on the right, should be on the left
21        //~| HELP switch the order
22        //~| SUGGESTION y @ Some(x)
23        _ => {}
24    }
25
26    match 2 {
27        e @ 1..=5 => {}
28        //~^ ERROR pattern on wrong side of `@`
29        //~| pattern on the left, should be on the right
30        //~| binding on the right, should be on the left
31        //~| HELP switch the order
32        //~| SUGGESTION e @ 1..=5
33        _ => {}
34    }
35}