]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add new test for box syntax
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Sun, 19 May 2024 00:11:36 +0000 (02:11 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Mar 2025 15:35:31 +0000 (16:35 +0100)
Add a new test to prevent regressions on the box syntax as well as its
feature gate.

gcc/testsuite/ChangeLog:

* rust/compile/box_syntax.rs: New test.
* rust/compile/box_syntax_feature_gate.rs: New test.

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

diff --git a/gcc/testsuite/rust/compile/box_syntax.rs b/gcc/testsuite/rust/compile/box_syntax.rs
new file mode 100644 (file)
index 0000000..c63284b
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-options "-fsyntax-only" }
+#![feature(box_syntax)]
+
+fn main() {
+    let x: Box<_> = box 1;
+}
diff --git a/gcc/testsuite/rust/compile/box_syntax_feature_gate.rs b/gcc/testsuite/rust/compile/box_syntax_feature_gate.rs
new file mode 100644 (file)
index 0000000..8eb5503
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-options "-frust-compile-until=lowering" }
+
+fn main() {
+    let x: Box<_> = box 1; //{ dg-error "box expression syntax is experimental." "" { target *-*-* }  }
+}