[gcc r14-7323] gccrs: testsuite: Add a test for .. in slice patterns

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:22:37 GMT 2024


https://gcc.gnu.org/g:d17c95a05210ecf4437eb97261b7f97de4383b8b

commit r14-7323-gd17c95a05210ecf4437eb97261b7f97de4383b8b
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Mar 1 11:36:42 2023 +0100

    gccrs: testsuite: Add a test for .. in slice patterns
    
    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>

Diff:
---
 gcc/testsuite/rust/compile/slice_rest_pattern.rs | 8 ++++++++
 1 file changed, 8 insertions(+)

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


More information about the Gcc-cvs mailing list