From: Pierre-Emmanuel Patry <[email protected]>
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 <[email protected]>
---
gcc/testsuite/rust/compile/box_syntax.rs | 6 ++++++
gcc/testsuite/rust/compile/box_syntax_feature_gate.rs | 5 +++++
2 files changed, 11 insertions(+)
create mode 100644 gcc/testsuite/rust/compile/box_syntax.rs
create mode 100644 gcc/testsuite/rust/compile/box_syntax_feature_gate.rs
diff --git a/gcc/testsuite/rust/compile/box_syntax.rs
b/gcc/testsuite/rust/compile/box_syntax.rs
new file mode 100644
index 00000000000..c63284b5163
--- /dev/null
+++ b/gcc/testsuite/rust/compile/box_syntax.rs
@@ -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
index 00000000000..8eb5503dde6
--- /dev/null
+++ b/gcc/testsuite/rust/compile/box_syntax_feature_gate.rs
@@ -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 *-*-* } }
+}
--
2.45.2