Add a few test to check the exclusive range pattern feature. This feature
is experimental and shall not be enabled in stable rust.
gcc/testsuite/ChangeLog:
* rust/compile/exclusive_range_pattern.rs: New test.
* rust/compile/exclusive_range_pattern_feature_gate.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
--- /dev/null
+// { dg-options "-fsyntax-only" }
+#![feature(exclusive_range_pattern)]
+
+const TEN: usize = 10;
+
+fn test(n: usize) {
+ match n {
+ 0..TEN => (),
+ TEN..20 => (),
+ 20..30 => (),
+ _ => (),
+ }
+}
+
+fn test2(t: usize) {
+ if let 0..10 = t {}
+}
--- /dev/null
+// { dg-options "-frust-compile-until=lowering" }
+
+fn test(n: usize) {
+ match n {
+ 0..10 => (), //{ dg-error "exclusive range pattern syntax is experimental." "" { target *-*-* } }
+ _ => (),
+ }
+}