Skip to content

Commit 22ae31c

Browse files
Add and update tests to use pattern_complexity
1 parent 02890f3 commit 22ae31c

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed

tests/ui/pattern/complexity_limit.rs

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#![feature(rustc_attrs)]
2+
#![pattern_complexity = "60"]
3+
4+
#[derive(Default)]
5+
struct BaseCommand {
6+
field01: bool,
7+
field02: bool,
8+
field03: bool,
9+
field04: bool,
10+
field05: bool,
11+
field06: bool,
12+
field07: bool,
13+
field08: bool,
14+
field09: bool,
15+
field10: bool,
16+
field11: bool,
17+
field12: bool,
18+
field13: bool,
19+
field14: bool,
20+
field15: bool,
21+
field16: bool,
22+
field17: bool,
23+
field18: bool,
24+
field19: bool,
25+
field20: bool,
26+
field21: bool,
27+
field22: bool,
28+
field23: bool,
29+
field24: bool,
30+
field25: bool,
31+
field26: bool,
32+
field27: bool,
33+
field28: bool,
34+
field29: bool,
35+
field30: bool,
36+
}
37+
38+
fn request_key(command: BaseCommand) {
39+
match command {
40+
BaseCommand { field01: true, .. } => {}
41+
BaseCommand { field02: true, .. } => {}
42+
BaseCommand { field03: true, .. } => {}
43+
BaseCommand { field04: true, .. } => {}
44+
BaseCommand { field05: true, .. } => {}
45+
BaseCommand { field06: true, .. } => {}
46+
BaseCommand { field07: true, .. } => {}
47+
BaseCommand { field08: true, .. } => {}
48+
BaseCommand { field09: true, .. } => {}
49+
BaseCommand { field10: true, .. } => {}
50+
BaseCommand { field11: true, .. } => {}
51+
BaseCommand { field12: true, .. } => {}
52+
BaseCommand { field13: true, .. } => {}
53+
BaseCommand { field14: true, .. } => {}
54+
BaseCommand { field15: true, .. } => {}
55+
BaseCommand { field16: true, .. } => {}
56+
BaseCommand { field17: true, .. } => {}
57+
BaseCommand { field18: true, .. } => {}
58+
BaseCommand { field19: true, .. } => {}
59+
BaseCommand { field20: true, .. } => {}
60+
BaseCommand { field21: true, .. } => {}
61+
BaseCommand { field22: true, .. } => {}
62+
BaseCommand { field23: true, .. } => {}
63+
BaseCommand { field24: true, .. } => {}
64+
BaseCommand { field25: true, .. } => {}
65+
BaseCommand { field26: true, .. } => {}
66+
BaseCommand { field27: true, .. } => {}
67+
BaseCommand { field28: true, .. } => {}
68+
BaseCommand { field29: true, .. } => {}
69+
BaseCommand { field30: true, .. } => {}
70+
71+
BaseCommand { field01: false, .. } => {}
72+
BaseCommand { field02: false, .. } => {}
73+
BaseCommand { field03: false, .. } => {}
74+
BaseCommand { field04: false, .. } => {}
75+
BaseCommand { field05: false, .. } => {}
76+
BaseCommand { field06: false, .. } => {}
77+
BaseCommand { field07: false, .. } => {}
78+
BaseCommand { field08: false, .. } => {}
79+
BaseCommand { field09: false, .. } => {}
80+
BaseCommand { field10: false, .. } => {}
81+
BaseCommand { field11: false, .. } => {}
82+
BaseCommand { field12: false, .. } => {}
83+
BaseCommand { field13: false, .. } => {}
84+
BaseCommand { field14: false, .. } => {}
85+
BaseCommand { field15: false, .. } => {}
86+
BaseCommand { field16: false, .. } => {}
87+
BaseCommand { field17: false, .. } => {}
88+
BaseCommand { field18: false, .. } => {}
89+
BaseCommand { field19: false, .. } => {}
90+
BaseCommand { field20: false, .. } => {}
91+
BaseCommand { field21: false, .. } => {}
92+
BaseCommand { field22: false, .. } => {}
93+
BaseCommand { field23: false, .. } => {}
94+
BaseCommand { field24: false, .. } => {}
95+
BaseCommand { field25: false, .. } => {}
96+
BaseCommand { field26: false, .. } => {}
97+
BaseCommand { field27: false, .. } => {}
98+
BaseCommand { field28: false, .. } => {}
99+
BaseCommand { field29: false, .. } => {}
100+
BaseCommand { field30: false, .. } => {}
101+
}
102+
}
103+
104+
fn main() {
105+
request_key(BaseCommand::default());
106+
}
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: reached pattern complexity limit
2+
3+
error: aborting due to 1 previous error
4+

tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![feature(rustc_attrs)]
2+
#![pattern_complexity = "61"]
3+
14
//@ check-pass
25
struct BaseCommand {
36
field01: bool,

0 commit comments

Comments
 (0)