]> git.ipfire.org Git - people/ms/gcc.git/commitdiff
testsuite: Add a test for .. in slice patterns
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 1 Mar 2023 10:36:42 +0000 (11:36 +0100)
committerPhilip Herron <philip.herron@embecosm.com>
Wed, 1 Mar 2023 21:31:47 +0000 (21:31 +0000)
Add a test to check wether the syntax of a RestPattern in a SlicePattern
parse correctly.

gcc/testsuite/ChangeLog:

* rust/compile/slice_rest_pattern.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/testsuite/rust/compile/slice_rest_pattern.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/slice_rest_pattern.rs b/gcc/testsuite/rust/compile/slice_rest_pattern.rs
new file mode 100644 (file)
index 0000000..c27a8dd
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-options "-fsyntax-only" }
+fn foo(a: &[u32]) {
+    match a {
+        [first, ..] => {}
+        [.., last] => {}
+        _ => {}
+    }
+}