From 36a21ef17c09dccc03d6d84a4f37b06b1b9cf716 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Sun, 19 May 2024 02:11:36 +0200 Subject: [PATCH] Add new test for box syntax 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 --- 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 000000000000..c63284b5163d --- /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 000000000000..8eb5503dde6c --- /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 *-*-* } } +}