about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/array-break-length.rs19
-rw-r--r--src/test/ui/array-break-length.stderr15
-rw-r--r--src/test/ui/closure-array-break-length.rs4
-rw-r--r--src/test/ui/closure-array-break-length.stderr15
-rw-r--r--src/test/ui/issue-51714.rs11
-rw-r--r--src/test/ui/issue-51714.stderr27
-rw-r--r--src/test/ui/return-match-array-const.rs17
-rw-r--r--src/test/ui/return-match-array-const.stderr21
8 files changed, 112 insertions, 17 deletions
diff --git a/src/test/ui/array-break-length.rs b/src/test/ui/array-break-length.rs
new file mode 100644
index 00000000000..c3cfff0e1f6
--- /dev/null
+++ b/src/test/ui/array-break-length.rs
@@ -0,0 +1,19 @@
+// Copyright 2018 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.
+
+fn main() {
+    loop {
+        |_: [_; break]| {} //~ ERROR: `break` outside of loop
+    }
+
+    loop {
+        |_: [_; continue]| {} //~ ERROR: `continue` outside of loop
+    }
+}
diff --git a/src/test/ui/array-break-length.stderr b/src/test/ui/array-break-length.stderr
new file mode 100644
index 00000000000..114245b9cc7
--- /dev/null
+++ b/src/test/ui/array-break-length.stderr
@@ -0,0 +1,15 @@
+error[E0268]: `break` outside of loop
+  --> $DIR/array-break-length.rs:13:17
+   |
+LL |         |_: [_; break]| {} //~ ERROR: `break` outside of loop
+   |                 ^^^^^ cannot break outside of a loop
+
+error[E0268]: `continue` outside of loop
+  --> $DIR/array-break-length.rs:17:17
+   |
+LL |         |_: [_; continue]| {} //~ ERROR: `continue` outside of loop
+   |                 ^^^^^^^^ cannot break outside of a loop
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0268`.
diff --git a/src/test/ui/closure-array-break-length.rs b/src/test/ui/closure-array-break-length.rs
index 2e99921956a..8be5b925a39 100644
--- a/src/test/ui/closure-array-break-length.rs
+++ b/src/test/ui/closure-array-break-length.rs
@@ -11,7 +11,7 @@
 fn main() {
     |_: [_; continue]| {}; //~ ERROR: `continue` outside of loop
 
-    while |_: [_; continue]| {} {} //~ ERROR: `break` or `continue` with no label
+    while |_: [_; continue]| {} {} //~ ERROR: `continue` outside of loop
 
-    while |_: [_; break]| {} {} //~ ERROR: `break` or `continue` with no label
+    while |_: [_; break]| {} {} //~ ERROR: `break` outside of loop
 }
diff --git a/src/test/ui/closure-array-break-length.stderr b/src/test/ui/closure-array-break-length.stderr
index 139153992e2..f62b1354370 100644
--- a/src/test/ui/closure-array-break-length.stderr
+++ b/src/test/ui/closure-array-break-length.stderr
@@ -4,19 +4,18 @@ error[E0268]: `continue` outside of loop
 LL |     |_: [_; continue]| {}; //~ ERROR: `continue` outside of loop
    |             ^^^^^^^^ cannot break outside of a loop
 
-error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+error[E0268]: `continue` outside of loop
   --> $DIR/closure-array-break-length.rs:14:19
    |
-LL |     while |_: [_; continue]| {} {} //~ ERROR: `break` or `continue` with no label
-   |                   ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
+LL |     while |_: [_; continue]| {} {} //~ ERROR: `continue` outside of loop
+   |                   ^^^^^^^^ cannot break outside of a loop
 
-error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+error[E0268]: `break` outside of loop
   --> $DIR/closure-array-break-length.rs:16:19
    |
-LL |     while |_: [_; break]| {} {} //~ ERROR: `break` or `continue` with no label
-   |                   ^^^^^ unlabeled `break` in the condition of a `while` loop
+LL |     while |_: [_; break]| {} {} //~ ERROR: `break` outside of loop
+   |                   ^^^^^ cannot break outside of a loop
 
 error: aborting due to 3 previous errors
 
-Some errors occurred: E0268, E0590.
-For more information about an error, try `rustc --explain E0268`.
+For more information about this error, try `rustc --explain E0268`.
diff --git a/src/test/ui/issue-51714.rs b/src/test/ui/issue-51714.rs
index 96c5b92ddfd..2b9d51f81b9 100644
--- a/src/test/ui/issue-51714.rs
+++ b/src/test/ui/issue-51714.rs
@@ -9,11 +9,16 @@
 // except according to those terms.
 
 fn main() {
-    |_:  [_; return || {}] | {}
+    |_:  [_; return || {}] | {};
     //~^ ERROR return statement outside of function body
-}
 
-fn foo() {
     [(); return || {}];
     //~^ ERROR return statement outside of function body
+
+    [(); return |ice| {}];
+    //~^ ERROR return statement outside of function body
+
+    [(); return while let Some(n) = Some(0) {}];
+    //~^ ERROR return statement outside of function body
+    //~^^ ERROR irrefutable while-let pattern
 }
diff --git a/src/test/ui/issue-51714.stderr b/src/test/ui/issue-51714.stderr
index 746adea6b7e..ddc70bfb38e 100644
--- a/src/test/ui/issue-51714.stderr
+++ b/src/test/ui/issue-51714.stderr
@@ -1,15 +1,34 @@
 error[E0572]: return statement outside of function body
   --> $DIR/issue-51714.rs:12:14
    |
-LL |     |_:  [_; return || {}] | {}
+LL |     |_:  [_; return || {}] | {};
    |              ^^^^^^^^^^^^
 
 error[E0572]: return statement outside of function body
-  --> $DIR/issue-51714.rs:17:10
+  --> $DIR/issue-51714.rs:15:10
    |
 LL |     [(); return || {}];
    |          ^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error[E0572]: return statement outside of function body
+  --> $DIR/issue-51714.rs:18:10
+   |
+LL |     [(); return |ice| {}];
+   |          ^^^^^^^^^^^^^^^
+
+error[E0572]: return statement outside of function body
+  --> $DIR/issue-51714.rs:21:10
+   |
+LL |     [(); return while let Some(n) = Some(0) {}];
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0165]: irrefutable while-let pattern
+  --> $DIR/issue-51714.rs:21:27
+   |
+LL |     [(); return while let Some(n) = Some(0) {}];
+   |                           ^^^^^^^ irrefutable pattern
+
+error: aborting due to 5 previous errors
 
-For more information about this error, try `rustc --explain E0572`.
+Some errors occurred: E0165, E0572.
+For more information about an error, try `rustc --explain E0165`.
diff --git a/src/test/ui/return-match-array-const.rs b/src/test/ui/return-match-array-const.rs
new file mode 100644
index 00000000000..45fc571d79d
--- /dev/null
+++ b/src/test/ui/return-match-array-const.rs
@@ -0,0 +1,17 @@
+// Copyright 2018 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.
+
+fn main() {
+    [(); return match 0 { n => n }]; //~ ERROR: return statement outside of function body
+
+    [(); return match 0 { 0 => 0 }]; //~ ERROR: return statement outside of function body
+
+    [(); return match () { 'a' => 0, _ => 0 }]; //~ ERROR: return statement outside of function body
+}
diff --git a/src/test/ui/return-match-array-const.stderr b/src/test/ui/return-match-array-const.stderr
new file mode 100644
index 00000000000..044dc8f5145
--- /dev/null
+++ b/src/test/ui/return-match-array-const.stderr
@@ -0,0 +1,21 @@
+error[E0572]: return statement outside of function body
+  --> $DIR/return-match-array-const.rs:12:10
+   |
+LL |     [(); return match 0 { n => n }]; //~ ERROR: return statement outside of function body
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0572]: return statement outside of function body
+  --> $DIR/return-match-array-const.rs:14:10
+   |
+LL |     [(); return match 0 { 0 => 0 }]; //~ ERROR: return statement outside of function body
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0572]: return statement outside of function body
+  --> $DIR/return-match-array-const.rs:16:10
+   |
+LL |     [(); return match () { 'a' => 0, _ => 0 }]; //~ ERROR: return statement outside of function body
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0572`.