]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add new test for closure in closure parsing
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 10 Oct 2023 12:16:52 +0000 (14:16 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:09:19 +0000 (19:09 +0100)
This new test highlight the fix of #2656.

gcc/testsuite/ChangeLog:

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

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

diff --git a/gcc/testsuite/rust/compile/closure_in_closure.rs b/gcc/testsuite/rust/compile/closure_in_closure.rs
new file mode 100644 (file)
index 0000000..1a00307
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-additional-options "-frust-compile-until=ast" }
+//
+// Do not reformat this test! The default rust format settings will insert a
+// space between closure parameter lists.
+fn main() {
+    let f = |_||x, y| x+y;
+    assert_eq!(f(())(1, 2), 3);
+}