blob: 1b23e60e0cac7d8a6915019bb67883a6d8bd9b3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#![feature(never_patterns)]
#![allow(incomplete_features)]
enum Void {}
fn main() {}
macro_rules! never {
() => { ! }
}
fn parse(x: Void) {
match None::<Void> {
None => {}
Some(!),
}
match None::<Void> {
Some(!),
None => {}
}
match None::<Void> {
None => {}
Some(!)
}
match None::<Void> {
Some(!)
//~^ ERROR expected `,` following `match` arm
None => {}
}
match None::<Void> {
Some(!) if true
//~^ ERROR expected `,` following `match` arm
//~| ERROR guard on a never pattern
None => {}
}
match None::<Void> {
Some(!) if true,
//~^ ERROR guard on a never pattern
None => {}
}
match None::<Void> {
Some(!) <=
//~^ ERROR expected one of
}
match x {
never!(),
}
match x {
never!() if true,
//~^ ERROR guard on a never pattern
}
match x {
never!()
}
match &x {
&never!(),
}
match None::<Void> {
Some(never!()),
None => {}
}
match x { ! }
match &x { &! }
let res: Result<bool, Void> = Ok(false);
let Ok(_) = res;
let Ok(_) | Err(!) = &res; // Disallowed; see #82048.
//~^ ERROR top-level or-patterns are not allowed in `let` bindings
let (Ok(_) | Err(!)) = &res;
let (Ok(_) | Err(&!)) = res.as_ref();
}
|