summaryrefslogtreecommitdiffstats
path: root/src/test/ui/label
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/label')
-rw-r--r--src/test/ui/label/label-beginning-with-underscore.rs10
-rw-r--r--src/test/ui/label/label-static.rs5
-rw-r--r--src/test/ui/label/label-static.stderr14
-rw-r--r--src/test/ui/label/label-underscore.rs5
-rw-r--r--src/test/ui/label/label-underscore.stderr14
-rw-r--r--src/test/ui/label/label_break_value_continue.rs26
-rw-r--r--src/test/ui/label/label_break_value_continue.stderr25
-rw-r--r--src/test/ui/label/label_break_value_desugared_break.rs19
-rw-r--r--src/test/ui/label/label_break_value_illegal_uses.fixed29
-rw-r--r--src/test/ui/label/label_break_value_illegal_uses.rs29
-rw-r--r--src/test/ui/label/label_break_value_illegal_uses.stderr26
-rw-r--r--src/test/ui/label/label_break_value_unlabeled_break.rs19
-rw-r--r--src/test/ui/label/label_break_value_unlabeled_break.stderr15
-rw-r--r--src/test/ui/label/label_misspelled.rs62
-rw-r--r--src/test/ui/label/label_misspelled.stderr206
-rw-r--r--src/test/ui/label/label_misspelled_2.rs16
-rw-r--r--src/test/ui/label/label_misspelled_2.stderr37
17 files changed, 0 insertions, 557 deletions
diff --git a/src/test/ui/label/label-beginning-with-underscore.rs b/src/test/ui/label/label-beginning-with-underscore.rs
deleted file mode 100644
index 4b620864a..000000000
--- a/src/test/ui/label/label-beginning-with-underscore.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// check-pass
-
-#![deny(unused_labels)]
-
-fn main() {
- // `unused_label` shouldn't warn labels beginning with `_`
- '_unused: loop {
- break;
- }
-}
diff --git a/src/test/ui/label/label-static.rs b/src/test/ui/label/label-static.rs
deleted file mode 100644
index 95e764d01..000000000
--- a/src/test/ui/label/label-static.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
- 'static: loop { //~ ERROR invalid label name `'static`
- break 'static //~ ERROR invalid label name `'static`
- }
-}
diff --git a/src/test/ui/label/label-static.stderr b/src/test/ui/label/label-static.stderr
deleted file mode 100644
index 1d3251d1b..000000000
--- a/src/test/ui/label/label-static.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: invalid label name `'static`
- --> $DIR/label-static.rs:2:5
- |
-LL | 'static: loop {
- | ^^^^^^^
-
-error: invalid label name `'static`
- --> $DIR/label-static.rs:3:15
- |
-LL | break 'static
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/label/label-underscore.rs b/src/test/ui/label/label-underscore.rs
deleted file mode 100644
index de67f3d2c..000000000
--- a/src/test/ui/label/label-underscore.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
- '_: loop { //~ ERROR invalid label name `'_`
- break '_ //~ ERROR invalid label name `'_`
- }
-}
diff --git a/src/test/ui/label/label-underscore.stderr b/src/test/ui/label/label-underscore.stderr
deleted file mode 100644
index 4558ec4cb..000000000
--- a/src/test/ui/label/label-underscore.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: invalid label name `'_`
- --> $DIR/label-underscore.rs:2:5
- |
-LL | '_: loop {
- | ^^
-
-error: invalid label name `'_`
- --> $DIR/label-underscore.rs:3:15
- |
-LL | break '_
- | ^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/label/label_break_value_continue.rs b/src/test/ui/label/label_break_value_continue.rs
deleted file mode 100644
index 22172f4fd..000000000
--- a/src/test/ui/label/label_break_value_continue.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-#![allow(unused_labels)]
-
-// Simple continue pointing to an unlabeled break should yield in an error
-fn continue_simple() {
- 'b: {
- continue; //~ ERROR unlabeled `continue` inside of a labeled block
- }
-}
-
-// Labeled continue pointing to an unlabeled break should yield in an error
-fn continue_labeled() {
- 'b: {
- continue 'b; //~ ERROR `continue` pointing to a labeled block
- }
-}
-
-// Simple continue that would cross a labeled block should yield in an error
-fn continue_crossing() {
- loop {
- 'b: {
- continue; //~ ERROR unlabeled `continue` inside of a labeled block
- }
- }
-}
-
-pub fn main() {}
diff --git a/src/test/ui/label/label_break_value_continue.stderr b/src/test/ui/label/label_break_value_continue.stderr
deleted file mode 100644
index 284d213d6..000000000
--- a/src/test/ui/label/label_break_value_continue.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0695]: unlabeled `continue` inside of a labeled block
- --> $DIR/label_break_value_continue.rs:6:9
- |
-LL | continue;
- | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label
-
-error[E0696]: `continue` pointing to a labeled block
- --> $DIR/label_break_value_continue.rs:13:9
- |
-LL | / 'b: {
-LL | | continue 'b;
- | | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d
-LL | | }
- | |_____- labeled block the `continue` points to
-
-error[E0695]: unlabeled `continue` inside of a labeled block
- --> $DIR/label_break_value_continue.rs:21:13
- |
-LL | continue;
- | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0695, E0696.
-For more information about an error, try `rustc --explain E0695`.
diff --git a/src/test/ui/label/label_break_value_desugared_break.rs b/src/test/ui/label/label_break_value_desugared_break.rs
deleted file mode 100644
index 70227d869..000000000
--- a/src/test/ui/label/label_break_value_desugared_break.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// compile-flags: --edition 2018
-#![feature(try_blocks)]
-
-// run-pass
-fn main() {
- let _: Result<(), ()> = try {
- 'foo: {
- Err(())?;
- break 'foo;
- }
- };
-
- 'foo: {
- let _: Result<(), ()> = try {
- Err(())?;
- break 'foo;
- };
- }
-}
diff --git a/src/test/ui/label/label_break_value_illegal_uses.fixed b/src/test/ui/label/label_break_value_illegal_uses.fixed
deleted file mode 100644
index fb75276b4..000000000
--- a/src/test/ui/label/label_break_value_illegal_uses.fixed
+++ /dev/null
@@ -1,29 +0,0 @@
-// run-rustfix
-
-// These are forbidden occurrences of label-break-value
-
-#[allow(unused_unsafe)]
-fn labeled_unsafe() {
- unsafe {} //~ ERROR block label not supported here
-}
-
-fn labeled_if() {
- if true {} //~ ERROR block label not supported here
-}
-
-fn labeled_else() {
- if true {} else {} //~ ERROR block label not supported here
-}
-
-fn labeled_match() {
- match false { //~ ERROR block label not supported here
- _ => {}
- }
-}
-
-fn main() {
- labeled_unsafe();
- labeled_if();
- labeled_else();
- labeled_match();
-}
diff --git a/src/test/ui/label/label_break_value_illegal_uses.rs b/src/test/ui/label/label_break_value_illegal_uses.rs
deleted file mode 100644
index 3cbf41380..000000000
--- a/src/test/ui/label/label_break_value_illegal_uses.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// run-rustfix
-
-// These are forbidden occurrences of label-break-value
-
-#[allow(unused_unsafe)]
-fn labeled_unsafe() {
- unsafe 'b: {} //~ ERROR block label not supported here
-}
-
-fn labeled_if() {
- if true 'b: {} //~ ERROR block label not supported here
-}
-
-fn labeled_else() {
- if true {} else 'b: {} //~ ERROR block label not supported here
-}
-
-fn labeled_match() {
- match false 'b: { //~ ERROR block label not supported here
- _ => {}
- }
-}
-
-fn main() {
- labeled_unsafe();
- labeled_if();
- labeled_else();
- labeled_match();
-}
diff --git a/src/test/ui/label/label_break_value_illegal_uses.stderr b/src/test/ui/label/label_break_value_illegal_uses.stderr
deleted file mode 100644
index 15016ffd5..000000000
--- a/src/test/ui/label/label_break_value_illegal_uses.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: block label not supported here
- --> $DIR/label_break_value_illegal_uses.rs:7:12
- |
-LL | unsafe 'b: {}
- | ^^^ not supported here
-
-error: block label not supported here
- --> $DIR/label_break_value_illegal_uses.rs:11:13
- |
-LL | if true 'b: {}
- | ^^^ not supported here
-
-error: block label not supported here
- --> $DIR/label_break_value_illegal_uses.rs:15:21
- |
-LL | if true {} else 'b: {}
- | ^^^ not supported here
-
-error: block label not supported here
- --> $DIR/label_break_value_illegal_uses.rs:19:17
- |
-LL | match false 'b: {
- | ^^^ not supported here
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/label/label_break_value_unlabeled_break.rs b/src/test/ui/label/label_break_value_unlabeled_break.rs
deleted file mode 100644
index 2a4f5d574..000000000
--- a/src/test/ui/label/label_break_value_unlabeled_break.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![allow(unused_labels)]
-
-// Simple unlabeled break should yield in an error
-fn unlabeled_break_simple() {
- 'b: {
- break; //~ ERROR unlabeled `break` inside of a labeled block
- }
-}
-
-// Unlabeled break that would cross a labeled block should yield in an error
-fn unlabeled_break_crossing() {
- loop {
- 'b: {
- break; //~ ERROR unlabeled `break` inside of a labeled block
- }
- }
-}
-
-pub fn main() {}
diff --git a/src/test/ui/label/label_break_value_unlabeled_break.stderr b/src/test/ui/label/label_break_value_unlabeled_break.stderr
deleted file mode 100644
index a2ccd27b8..000000000
--- a/src/test/ui/label/label_break_value_unlabeled_break.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0695]: unlabeled `break` inside of a labeled block
- --> $DIR/label_break_value_unlabeled_break.rs:6:9
- |
-LL | break;
- | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label
-
-error[E0695]: unlabeled `break` inside of a labeled block
- --> $DIR/label_break_value_unlabeled_break.rs:14:13
- |
-LL | break;
- | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0695`.
diff --git a/src/test/ui/label/label_misspelled.rs b/src/test/ui/label/label_misspelled.rs
deleted file mode 100644
index e3180b06e..000000000
--- a/src/test/ui/label/label_misspelled.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-#![warn(unused_labels)]
-
-fn main() {
- 'while_loop: while true { //~ WARN denote infinite loops with
- //~^ WARN unused label
- while_loop;
- //~^ ERROR cannot find value `while_loop` in this scope
- };
- 'while_let: while let Some(_) = Some(()) {
- //~^ WARN unused label
- while_let;
- //~^ ERROR cannot find value `while_let` in this scope
- }
- 'for_loop: for _ in 0..3 {
- //~^ WARN unused label
- for_loop;
- //~^ ERROR cannot find value `for_loop` in this scope
- };
- 'LOOP: loop {
- //~^ WARN unused label
- LOOP;
- //~^ ERROR cannot find value `LOOP` in this scope
- };
-}
-
-fn foo() {
- 'LOOP: loop {
- break LOOP;
- //~^ ERROR cannot find value `LOOP` in this scope
- };
- 'while_loop: while true { //~ WARN denote infinite loops with
- break while_loop;
- //~^ ERROR cannot find value `while_loop` in this scope
- };
- 'while_let: while let Some(_) = Some(()) {
- break while_let;
- //~^ ERROR cannot find value `while_let` in this scope
- }
- 'for_loop: for _ in 0..3 {
- break for_loop;
- //~^ ERROR cannot find value `for_loop` in this scope
- };
-}
-
-fn bar() {
- let foo = ();
- 'while_loop: while true { //~ WARN denote infinite loops with
- //~^ WARN unused label
- break foo;
- //~^ ERROR `break` with value from a `while` loop
- };
- 'while_let: while let Some(_) = Some(()) {
- //~^ WARN unused label
- break foo;
- //~^ ERROR `break` with value from a `while` loop
- }
- 'for_loop: for _ in 0..3 {
- //~^ WARN unused label
- break foo;
- //~^ ERROR `break` with value from a `for` loop
- };
-}
diff --git a/src/test/ui/label/label_misspelled.stderr b/src/test/ui/label/label_misspelled.stderr
deleted file mode 100644
index 4b5b9e92c..000000000
--- a/src/test/ui/label/label_misspelled.stderr
+++ /dev/null
@@ -1,206 +0,0 @@
-error[E0425]: cannot find value `while_loop` in this scope
- --> $DIR/label_misspelled.rs:6:9
- |
-LL | 'while_loop: while true {
- | ----------- a label with a similar name exists
-LL |
-LL | while_loop;
- | ^^^^^^^^^^ not found in this scope
-
-error[E0425]: cannot find value `while_let` in this scope
- --> $DIR/label_misspelled.rs:11:9
- |
-LL | 'while_let: while let Some(_) = Some(()) {
- | ---------- a label with a similar name exists
-LL |
-LL | while_let;
- | ^^^^^^^^^ not found in this scope
-
-error[E0425]: cannot find value `for_loop` in this scope
- --> $DIR/label_misspelled.rs:16:9
- |
-LL | 'for_loop: for _ in 0..3 {
- | --------- a label with a similar name exists
-LL |
-LL | for_loop;
- | ^^^^^^^^ not found in this scope
-
-error[E0425]: cannot find value `LOOP` in this scope
- --> $DIR/label_misspelled.rs:21:9
- |
-LL | 'LOOP: loop {
- | ----- a label with a similar name exists
-LL |
-LL | LOOP;
- | ^^^^ not found in this scope
-
-error[E0425]: cannot find value `LOOP` in this scope
- --> $DIR/label_misspelled.rs:28:15
- |
-LL | 'LOOP: loop {
- | ----- a label with a similar name exists
-LL | break LOOP;
- | ^^^^
- | |
- | not found in this scope
- | help: use the similarly named label: `'LOOP`
-
-error[E0425]: cannot find value `while_loop` in this scope
- --> $DIR/label_misspelled.rs:32:15
- |
-LL | 'while_loop: while true {
- | ----------- a label with a similar name exists
-LL | break while_loop;
- | ^^^^^^^^^^
- | |
- | not found in this scope
- | help: use the similarly named label: `'while_loop`
-
-error[E0425]: cannot find value `while_let` in this scope
- --> $DIR/label_misspelled.rs:36:15
- |
-LL | 'while_let: while let Some(_) = Some(()) {
- | ---------- a label with a similar name exists
-LL | break while_let;
- | ^^^^^^^^^
- | |
- | not found in this scope
- | help: use the similarly named label: `'while_let`
-
-error[E0425]: cannot find value `for_loop` in this scope
- --> $DIR/label_misspelled.rs:40:15
- |
-LL | 'for_loop: for _ in 0..3 {
- | --------- a label with a similar name exists
-LL | break for_loop;
- | ^^^^^^^^
- | |
- | not found in this scope
- | help: use the similarly named label: `'for_loop`
-
-warning: unused label
- --> $DIR/label_misspelled.rs:4:5
- |
-LL | 'while_loop: while true {
- | ^^^^^^^^^^^
- |
-note: the lint level is defined here
- --> $DIR/label_misspelled.rs:1:9
- |
-LL | #![warn(unused_labels)]
- | ^^^^^^^^^^^^^
-
-warning: denote infinite loops with `loop { ... }`
- --> $DIR/label_misspelled.rs:4:5
- |
-LL | 'while_loop: while true {
- | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
- |
- = note: `#[warn(while_true)]` on by default
-
-warning: unused label
- --> $DIR/label_misspelled.rs:9:5
- |
-LL | 'while_let: while let Some(_) = Some(()) {
- | ^^^^^^^^^^
-
-warning: unused label
- --> $DIR/label_misspelled.rs:14:5
- |
-LL | 'for_loop: for _ in 0..3 {
- | ^^^^^^^^^
-
-warning: unused label
- --> $DIR/label_misspelled.rs:19:5
- |
-LL | 'LOOP: loop {
- | ^^^^^
-
-warning: denote infinite loops with `loop { ... }`
- --> $DIR/label_misspelled.rs:31:5
- |
-LL | 'while_loop: while true {
- | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
-
-warning: unused label
- --> $DIR/label_misspelled.rs:47:5
- |
-LL | 'while_loop: while true {
- | ^^^^^^^^^^^
-
-warning: denote infinite loops with `loop { ... }`
- --> $DIR/label_misspelled.rs:47:5
- |
-LL | 'while_loop: while true {
- | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
-
-warning: unused label
- --> $DIR/label_misspelled.rs:52:5
- |
-LL | 'while_let: while let Some(_) = Some(()) {
- | ^^^^^^^^^^
-
-warning: unused label
- --> $DIR/label_misspelled.rs:57:5
- |
-LL | 'for_loop: for _ in 0..3 {
- | ^^^^^^^^^
-
-error[E0571]: `break` with value from a `while` loop
- --> $DIR/label_misspelled.rs:49:9
- |
-LL | 'while_loop: while true {
- | ----------------------- you can't `break` with a value in a `while` loop
-LL |
-LL | break foo;
- | ^^^^^^^^^ can only break with a value inside `loop` or breakable block
- |
-help: use `break` on its own without a value inside this `while` loop
- |
-LL | break;
- | ~~~~~
-help: alternatively, you might have meant to use the available loop label
- |
-LL | break 'while_loop;
- | ~~~~~~~~~~~
-
-error[E0571]: `break` with value from a `while` loop
- --> $DIR/label_misspelled.rs:54:9
- |
-LL | 'while_let: while let Some(_) = Some(()) {
- | ---------------------------------------- you can't `break` with a value in a `while` loop
-LL |
-LL | break foo;
- | ^^^^^^^^^ can only break with a value inside `loop` or breakable block
- |
-help: use `break` on its own without a value inside this `while` loop
- |
-LL | break;
- | ~~~~~
-help: alternatively, you might have meant to use the available loop label
- |
-LL | break 'while_let;
- | ~~~~~~~~~~
-
-error[E0571]: `break` with value from a `for` loop
- --> $DIR/label_misspelled.rs:59:9
- |
-LL | 'for_loop: for _ in 0..3 {
- | ------------------------ you can't `break` with a value in a `for` loop
-LL |
-LL | break foo;
- | ^^^^^^^^^ can only break with a value inside `loop` or breakable block
- |
-help: use `break` on its own without a value inside this `for` loop
- |
-LL | break;
- | ~~~~~
-help: alternatively, you might have meant to use the available loop label
- |
-LL | break 'for_loop;
- | ~~~~~~~~~
-
-error: aborting due to 11 previous errors; 10 warnings emitted
-
-Some errors have detailed explanations: E0425, E0571.
-For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/ui/label/label_misspelled_2.rs b/src/test/ui/label/label_misspelled_2.rs
deleted file mode 100644
index 55bbe6b30..000000000
--- a/src/test/ui/label/label_misspelled_2.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-#![warn(unused_labels)]
-
-fn main() {
- 'a: for _ in 0..1 {
- break 'a;
- }
- 'b: for _ in 0..1 {
- break b; //~ ERROR cannot find value `b` in this scope
- }
- c: for _ in 0..1 { //~ ERROR malformed loop label
- break 'c;
- }
- d: for _ in 0..1 { //~ ERROR malformed loop label
- break d; //~ ERROR cannot find value `d` in this scope
- }
-}
diff --git a/src/test/ui/label/label_misspelled_2.stderr b/src/test/ui/label/label_misspelled_2.stderr
deleted file mode 100644
index 960646d98..000000000
--- a/src/test/ui/label/label_misspelled_2.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: malformed loop label
- --> $DIR/label_misspelled_2.rs:10:5
- |
-LL | c: for _ in 0..1 {
- | ^ help: use the correct loop label format: `'c`
-
-error: malformed loop label
- --> $DIR/label_misspelled_2.rs:13:5
- |
-LL | d: for _ in 0..1 {
- | ^ help: use the correct loop label format: `'d`
-
-error[E0425]: cannot find value `b` in this scope
- --> $DIR/label_misspelled_2.rs:8:15
- |
-LL | 'b: for _ in 0..1 {
- | -- a label with a similar name exists
-LL | break b;
- | ^
- | |
- | not found in this scope
- | help: use the similarly named label: `'b`
-
-error[E0425]: cannot find value `d` in this scope
- --> $DIR/label_misspelled_2.rs:14:15
- |
-LL | d: for _ in 0..1 {
- | - a label with a similar name exists
-LL | break d;
- | ^
- | |
- | not found in this scope
- | help: use the similarly named label: `'d`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0425`.