about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs18
-rw-r--r--src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs18
-rw-r--r--src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs18
3 files changed, 54 insertions, 0 deletions
diff --git a/src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs b/src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs
new file mode 100644
index 00000000000..69e5898ed4d
--- /dev/null
+++ b/src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs
@@ -0,0 +1,18 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(exclusive_range_pattern)]
+
+fn main() {
+    match [5..4, 99..105, 43..44] {
+        [_, 99.., _] => {}, //~ ERROR unexpected token: `,`
+        _ => {},
+    }
+}
diff --git a/src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs b/src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs
new file mode 100644
index 00000000000..9212ea86118
--- /dev/null
+++ b/src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs
@@ -0,0 +1,18 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(exclusive_range_pattern)]
+
+fn main() {
+    match [5..4, 99..105, 43..44] {
+        [_, 99..] => {}, //~ ERROR unexpected token: `]`
+        _ => {},
+    }
+}
diff --git a/src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs b/src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs
new file mode 100644
index 00000000000..d83305857ac
--- /dev/null
+++ b/src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs
@@ -0,0 +1,18 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(exclusive_range_pattern)]
+
+fn main() {
+    match [5..4, 99..105, 43..44] {
+        [..9, 99..100, _] => {}, //~ ERROR expected one of `,` or `]`, found `9`
+        _ => {},
+    }
+}