about summary refs log tree commit diff
path: root/tests/ui/pattern
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2023-11-29 21:43:06 +0100
committerNadrieril <nadrieril+git@gmail.com>2023-12-23 13:11:38 +0100
commit71e83347bb1004d3aa9eaa138e2bdefa585101d1 (patch)
treee18626579740161168138a988da434f2e74675ab /tests/ui/pattern
parentc03d978a4bcb7c01d8cdf80bd7600b27e2d21588 (diff)
downloadrust-71e83347bb1004d3aa9eaa138e2bdefa585101d1.tar.gz
rust-71e83347bb1004d3aa9eaa138e2bdefa585101d1.zip
Improve performance on wide matches
Diffstat (limited to 'tests/ui/pattern')
-rw-r--r--tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs
new file mode 100644
index 00000000000..39ad2d4abf3
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs
@@ -0,0 +1,72 @@
+// check-pass
+struct BaseCommand {
+    field01: bool,
+    field02: bool,
+    field03: bool,
+    field04: bool,
+    field05: bool,
+    field06: bool,
+    field07: bool,
+    field08: bool,
+    field09: bool,
+    field10: bool,
+    field11: bool,
+    field12: bool,
+    field13: bool,
+    field14: bool,
+    field15: bool,
+    field16: bool,
+    field17: bool,
+    field18: bool,
+    field19: bool,
+    field20: bool,
+    field21: bool,
+    field22: bool,
+    field23: bool,
+    field24: bool,
+    field25: bool,
+    field26: bool,
+    field27: bool,
+    field28: bool,
+    field29: bool,
+    field30: bool,
+}
+
+fn request_key(command: BaseCommand) {
+    match command {
+        BaseCommand { field01: true, .. } => {}
+        BaseCommand { field02: true, .. } => {}
+        BaseCommand { field03: true, .. } => {}
+        BaseCommand { field04: true, .. } => {}
+        BaseCommand { field05: true, .. } => {}
+        BaseCommand { field06: true, .. } => {}
+        BaseCommand { field07: true, .. } => {}
+        BaseCommand { field08: true, .. } => {}
+        BaseCommand { field09: true, .. } => {}
+        BaseCommand { field10: true, .. } => {}
+        BaseCommand { field11: true, .. } => {}
+        BaseCommand { field12: true, .. } => {}
+        BaseCommand { field13: true, .. } => {}
+        BaseCommand { field14: true, .. } => {}
+        BaseCommand { field15: true, .. } => {}
+        BaseCommand { field16: true, .. } => {}
+        BaseCommand { field17: true, .. } => {}
+        BaseCommand { field18: true, .. } => {}
+        BaseCommand { field19: true, .. } => {}
+        BaseCommand { field20: true, .. } => {}
+        BaseCommand { field21: true, .. } => {}
+        BaseCommand { field22: true, .. } => {}
+        BaseCommand { field23: true, .. } => {}
+        BaseCommand { field24: true, .. } => {}
+        BaseCommand { field25: true, .. } => {}
+        BaseCommand { field26: true, .. } => {}
+        BaseCommand { field27: true, .. } => {}
+        BaseCommand { field28: true, .. } => {}
+        BaseCommand { field29: true, .. } => {}
+        BaseCommand { field30: true, .. } => {}
+
+        _ => {}
+    }
+}
+
+fn main() {}