]> git.lizzy.rs Git - rust.git/commitdiff
test slice patterns with exclusive range patterns
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Thu, 19 Jan 2017 14:14:02 +0000 (15:14 +0100)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Thu, 19 Jan 2017 14:14:02 +0000 (15:14 +0100)
src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs [new file with mode: 0644]
src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs [new file with mode: 0644]
src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs [new file with mode: 0644]

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 (file)
index 0000000..69e5898
--- /dev/null
@@ -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 (file)
index 0000000..9212ea8
--- /dev/null
@@ -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 (file)
index 0000000..d833058
--- /dev/null
@@ -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`
+        _ => {},
+    }
+}