about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTaylor Cramer <cramertaylorj@gmail.com>2017-03-06 18:16:57 -0800
committerTaylor Cramer <cramertaylorj@gmail.com>2017-03-11 22:26:57 -0800
commitb1aa99352a69e328094e096bbbd1741b68c0667f (patch)
treedc54ebc1cdf86f02d23b35601bbf78ae922284a8 /src
parentea4e8b0a81171d4d6c28a61fa0d1c4d74837bb65 (diff)
downloadrust-b1aa99352a69e328094e096bbbd1741b68c0667f.tar.gz
rust-b1aa99352a69e328094e096bbbd1741b68c0667f.zip
Add compile-fail tests for catch expr in match or condition
Diffstat (limited to 'src')
-rw-r--r--src/test/compile-fail/catch-in-match.rs15
-rw-r--r--src/test/compile-fail/catch-in-while.rs15
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/compile-fail/catch-in-match.rs b/src/test/compile-fail/catch-in-match.rs
new file mode 100644
index 00000000000..9f9968e8124
--- /dev/null
+++ b/src/test/compile-fail/catch-in-match.rs
@@ -0,0 +1,15 @@
+// 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(catch_expr)]
+
+fn main() {
+    match do catch { false } { _ => {} } //~ ERROR expected expression, found reserved keyword `do`
+}
diff --git a/src/test/compile-fail/catch-in-while.rs b/src/test/compile-fail/catch-in-while.rs
new file mode 100644
index 00000000000..cb8613ee60b
--- /dev/null
+++ b/src/test/compile-fail/catch-in-while.rs
@@ -0,0 +1,15 @@
+// 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(catch_expr)]
+
+fn main() {
+    while do catch { false } {} //~ ERROR expected expression, found reserved keyword `do`
+}