diff options
Diffstat (limited to 'src/test/ui/loops')
-rw-r--r-- | src/test/ui/loops/for-each-loop-panic.rs | 9 | ||||
-rw-r--r-- | src/test/ui/loops/issue-82916.rs | 10 | ||||
-rw-r--r-- | src/test/ui/loops/issue-82916.stderr | 24 | ||||
-rw-r--r-- | src/test/ui/loops/loop-break-unsize.rs | 8 | ||||
-rw-r--r-- | src/test/ui/loops/loop-break-value-no-repeat.rs | 14 | ||||
-rw-r--r-- | src/test/ui/loops/loop-break-value-no-repeat.stderr | 16 | ||||
-rw-r--r-- | src/test/ui/loops/loop-break-value.rs | 98 | ||||
-rw-r--r-- | src/test/ui/loops/loop-break-value.stderr | 193 | ||||
-rw-r--r-- | src/test/ui/loops/loop-labeled-break-value.rs | 11 | ||||
-rw-r--r-- | src/test/ui/loops/loop-labeled-break-value.stderr | 30 | ||||
-rw-r--r-- | src/test/ui/loops/loop-no-implicit-break.rs | 31 | ||||
-rw-r--r-- | src/test/ui/loops/loop-no-implicit-break.stderr | 47 | ||||
-rw-r--r-- | src/test/ui/loops/loop-proper-liveness.rs | 32 | ||||
-rw-r--r-- | src/test/ui/loops/loop-proper-liveness.stderr | 18 | ||||
-rw-r--r-- | src/test/ui/loops/loop-properly-diverging-2.rs | 6 | ||||
-rw-r--r-- | src/test/ui/loops/loop-properly-diverging-2.stderr | 12 |
16 files changed, 0 insertions, 559 deletions
diff --git a/src/test/ui/loops/for-each-loop-panic.rs b/src/test/ui/loops/for-each-loop-panic.rs deleted file mode 100644 index 5156999f4..000000000 --- a/src/test/ui/loops/for-each-loop-panic.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-fail -// error-pattern:moop -// ignore-emscripten no processes - -fn main() { - for _ in 0_usize..10_usize { - panic!("moop"); - } -} diff --git a/src/test/ui/loops/issue-82916.rs b/src/test/ui/loops/issue-82916.rs deleted file mode 100644 index 8633ea1e8..000000000 --- a/src/test/ui/loops/issue-82916.rs +++ /dev/null @@ -1,10 +0,0 @@ -struct S(i32); - -fn foo(x: Vec<S>) { - for y in x { - - } - let z = x; //~ ERROR use of moved value: `x` -} - -fn main() {} diff --git a/src/test/ui/loops/issue-82916.stderr b/src/test/ui/loops/issue-82916.stderr deleted file mode 100644 index 57d76016c..000000000 --- a/src/test/ui/loops/issue-82916.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0382]: use of moved value: `x` - --> $DIR/issue-82916.rs:7:13 - | -LL | fn foo(x: Vec<S>) { - | - move occurs because `x` has type `Vec<S>`, which does not implement the `Copy` trait -LL | for y in x { - | - `x` moved due to this implicit call to `.into_iter()` -... -LL | let z = x; - | ^ value used here after move - | -note: this function takes ownership of the receiver `self`, which moves `x` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ -help: consider iterating over a slice of the `Vec<S>`'s content to avoid moving into the `for` loop - | -LL | for y in &x { - | + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/loops/loop-break-unsize.rs b/src/test/ui/loops/loop-break-unsize.rs deleted file mode 100644 index 974c63cea..000000000 --- a/src/test/ui/loops/loop-break-unsize.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Regression test for #62312 -// check-pass - -fn main() { - let _ = loop { - break Box::new(()) as Box<dyn Send>; - }; -} diff --git a/src/test/ui/loops/loop-break-value-no-repeat.rs b/src/test/ui/loops/loop-break-value-no-repeat.rs deleted file mode 100644 index 1c0b7a018..000000000 --- a/src/test/ui/loops/loop-break-value-no-repeat.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(unused_variables)] - -use std::ptr; - -// Test that we only report **one** error here and that is that -// `break` with an expression is illegal in this context. In -// particular, we don't report any mismatched types error, which is -// besides the point. - -fn main() { - for _ in &[1,2,3] { - break 22 //~ ERROR `break` with value from a `for` loop - } -} diff --git a/src/test/ui/loops/loop-break-value-no-repeat.stderr b/src/test/ui/loops/loop-break-value-no-repeat.stderr deleted file mode 100644 index 605a1841c..000000000 --- a/src/test/ui/loops/loop-break-value-no-repeat.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value-no-repeat.rs:12:9 - | -LL | for _ in &[1,2,3] { - | ----------------- you can't `break` with a value in a `for` loop -LL | break 22 - | ^^^^^^^^ 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 - | ~~~~~ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0571`. diff --git a/src/test/ui/loops/loop-break-value.rs b/src/test/ui/loops/loop-break-value.rs deleted file mode 100644 index 51c9a36a0..000000000 --- a/src/test/ui/loops/loop-break-value.rs +++ /dev/null @@ -1,98 +0,0 @@ -#![feature(never_type)] - -fn main() { - let val: ! = loop { break break; }; - //~^ ERROR mismatched types - - loop { - if true { - break "asdf"; - } else { - break 123; //~ ERROR mismatched types - } - }; - - let _: i32 = loop { - break "asdf"; //~ ERROR mismatched types - }; - - let _: i32 = 'outer_loop: loop { - loop { - break 'outer_loop "nope"; //~ ERROR mismatched types - break "ok"; - }; - }; - - 'while_loop: while true { //~ WARN denote infinite loops with - break; - break (); //~ ERROR `break` with value from a `while` loop - loop { - break 'while_loop 123; - //~^ ERROR `break` with value from a `while` loop - break 456; - break 789; - }; - } - - while let Some(_) = Some(()) { - if break () { //~ ERROR `break` with value from a `while` loop - } - } - - while let Some(_) = Some(()) { - break None; - //~^ ERROR `break` with value from a `while` loop - } - - 'while_let_loop: while let Some(_) = Some(()) { - loop { - break 'while_let_loop "nope"; - //~^ ERROR `break` with value from a `while` loop - break 33; - }; - } - - for _ in &[1,2,3] { - break (); //~ ERROR `break` with value from a `for` loop - break [()]; - //~^ ERROR `break` with value from a `for` loop - } - - 'for_loop: for _ in &[1,2,3] { - loop { - break Some(3); - break 'for_loop Some(17); - //~^ ERROR `break` with value from a `for` loop - }; - } - - let _: i32 = 'a: loop { - let _: () = 'b: loop { - break ('c: loop { - break; - break 'c 123; //~ ERROR mismatched types - }); - break 'a 123; - }; - }; - - loop { - break (break, break); //~ ERROR mismatched types - }; - - loop { - break; - break 2; //~ ERROR mismatched types - }; - - loop { - break 2; - break; //~ ERROR mismatched types - break 4; - }; - - 'LOOP: for _ in 0 .. 9 { - break LOOP; - //~^ ERROR cannot find value `LOOP` in this scope - } -} diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr deleted file mode 100644 index ccb27c350..000000000 --- a/src/test/ui/loops/loop-break-value.stderr +++ /dev/null @@ -1,193 +0,0 @@ -error[E0425]: cannot find value `LOOP` in this scope - --> $DIR/loop-break-value.rs:95:15 - | -LL | 'LOOP: for _ in 0 .. 9 { - | ----- a label with a similar name exists -LL | break LOOP; - | ^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'LOOP` - -warning: denote infinite loops with `loop { ... }` - --> $DIR/loop-break-value.rs:26:5 - | -LL | 'while_loop: while true { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` - | - = note: `#[warn(while_true)]` on by default - -error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:28:9 - | -LL | 'while_loop: while true { - | ----------------------- you can't `break` with a value in a `while` loop -LL | break; -LL | break (); - | ^^^^^^^^ 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/loop-break-value.rs:30:13 - | -LL | 'while_loop: while true { - | ----------------------- you can't `break` with a value in a `while` loop -... -LL | break 'while_loop 123; - | ^^^^^^^^^^^^^^^^^^^^^ 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 'while_loop; - | ~~~~~~~~~~~~~~~~~ - -error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:38:12 - | -LL | while let Some(_) = Some(()) { - | ---------------------------- you can't `break` with a value in a `while` loop -LL | if break () { - | ^^^^^^^^ 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 | if break { - | ~~~~~ - -error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:43:9 - | -LL | while let Some(_) = Some(()) { - | ---------------------------- you can't `break` with a value in a `while` loop -LL | break None; - | ^^^^^^^^^^ 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; - | ~~~~~ - -error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:49:13 - | -LL | 'while_let_loop: while let Some(_) = Some(()) { - | --------------------------------------------- you can't `break` with a value in a `while` loop -LL | loop { -LL | break 'while_let_loop "nope"; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 'while_let_loop; - | ~~~~~~~~~~~~~~~~~~~~~ - -error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:56:9 - | -LL | for _ in &[1,2,3] { - | ----------------- you can't `break` with a value in a `for` loop -LL | break (); - | ^^^^^^^^ 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; - | ~~~~~ - -error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:57:9 - | -LL | for _ in &[1,2,3] { - | ----------------- you can't `break` with a value in a `for` loop -LL | break (); -LL | break [()]; - | ^^^^^^^^^^ 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; - | ~~~~~ - -error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:64:13 - | -LL | 'for_loop: for _ in &[1,2,3] { - | ---------------------------- you can't `break` with a value in a `for` loop -... -LL | break 'for_loop Some(17); - | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 'for_loop; - | ~~~~~~~~~~~~~~~ - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:4:31 - | -LL | let val: ! = loop { break break; }; - | ^^^^^ expected `!`, found `()` - | - = note: expected type `!` - found unit type `()` - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:11:19 - | -LL | break 123; - | ^^^ expected `&str`, found integer - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:16:15 - | -LL | break "asdf"; - | ^^^^^^ expected `i32`, found `&str` - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:21:31 - | -LL | break 'outer_loop "nope"; - | ^^^^^^ expected `i32`, found `&str` - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:73:26 - | -LL | break 'c 123; - | ^^^ expected `()`, found integer - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:80:15 - | -LL | break (break, break); - | ^^^^^^^^^^^^^^ expected `()`, found tuple - | - = note: expected unit type `()` - found tuple `(!, !)` - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:85:15 - | -LL | break 2; - | ^ expected `()`, found integer - -error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:90:9 - | -LL | break; - | ^^^^^ - | | - | expected integer, found `()` - | help: give it a value of the expected type: `break value` - -error: aborting due to 17 previous errors; 1 warning emitted - -Some errors have detailed explanations: E0308, E0425, E0571. -For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/loops/loop-labeled-break-value.rs b/src/test/ui/loops/loop-labeled-break-value.rs deleted file mode 100644 index 3488b057b..000000000 --- a/src/test/ui/loops/loop-labeled-break-value.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn main() { - loop { - let _: i32 = loop { break }; //~ ERROR mismatched types - } - loop { - let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched types - } - loop { - let _: i32 = 'inner2: loop { loop { break 'inner2 } }; //~ ERROR mismatched types - } -} diff --git a/src/test/ui/loops/loop-labeled-break-value.stderr b/src/test/ui/loops/loop-labeled-break-value.stderr deleted file mode 100644 index aa04d330f..000000000 --- a/src/test/ui/loops/loop-labeled-break-value.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/loop-labeled-break-value.rs:3:29 - | -LL | let _: i32 = loop { break }; - | ^^^^^ - | | - | expected `i32`, found `()` - | help: give it a value of the expected type: `break 42` - -error[E0308]: mismatched types - --> $DIR/loop-labeled-break-value.rs:6:37 - | -LL | let _: i32 = 'inner: loop { break 'inner }; - | ^^^^^^^^^^^^ - | | - | expected `i32`, found `()` - | help: give it a value of the expected type: `break 'inner 42` - -error[E0308]: mismatched types - --> $DIR/loop-labeled-break-value.rs:9:45 - | -LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; - | ^^^^^^^^^^^^^ - | | - | expected `i32`, found `()` - | help: give it a value of the expected type: `break 'inner2 42` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/loops/loop-no-implicit-break.rs b/src/test/ui/loops/loop-no-implicit-break.rs deleted file mode 100644 index 93078cb4b..000000000 --- a/src/test/ui/loops/loop-no-implicit-break.rs +++ /dev/null @@ -1,31 +0,0 @@ -fn main() { - let a: i8 = loop { - 1 //~ ERROR mismatched types - }; - - let b: i8 = loop { - break 1; - }; -} - -fn foo() -> i8 { - let a: i8 = loop { - 1 //~ ERROR mismatched types - }; - - let b: i8 = loop { - break 1; - }; - - loop { - 1 //~ ERROR mismatched types - } - - loop { - return 1; - } - - loop { - 1 //~ ERROR mismatched types - } -} diff --git a/src/test/ui/loops/loop-no-implicit-break.stderr b/src/test/ui/loops/loop-no-implicit-break.stderr deleted file mode 100644 index 8a1afdea2..000000000 --- a/src/test/ui/loops/loop-no-implicit-break.stderr +++ /dev/null @@ -1,47 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/loop-no-implicit-break.rs:3:9 - | -LL | 1 - | ^ expected `()`, found integer - | -help: you might have meant to break the loop with this value - | -LL | break 1; - | +++++ + - -error[E0308]: mismatched types - --> $DIR/loop-no-implicit-break.rs:13:9 - | -LL | 1 - | ^ expected `()`, found integer - | -help: you might have meant to break the loop with this value - | -LL | break 1; - | +++++ + - -error[E0308]: mismatched types - --> $DIR/loop-no-implicit-break.rs:21:9 - | -LL | 1 - | ^ expected `()`, found integer - | -help: you might have meant to return this value - | -LL | return 1; - | ++++++ + - -error[E0308]: mismatched types - --> $DIR/loop-no-implicit-break.rs:29:9 - | -LL | 1 - | ^ expected `()`, found integer - | -help: you might have meant to return this value - | -LL | return 1; - | ++++++ + - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/loops/loop-proper-liveness.rs b/src/test/ui/loops/loop-proper-liveness.rs deleted file mode 100644 index 6546e3977..000000000 --- a/src/test/ui/loops/loop-proper-liveness.rs +++ /dev/null @@ -1,32 +0,0 @@ -fn test1() { - // In this test the outer 'a loop may terminate without `x` getting initialised. Although the - // `x = loop { ... }` statement is reached, the value itself ends up never being computed and - // thus leaving `x` uninit. - let x: i32; - 'a: loop { - x = loop { break 'a }; - } - println!("{:?}", x); //~ ERROR E0381 -} - -// test2 and test3 should not fail. -fn test2() { - // In this test the `'a` loop will never terminate thus making the use of `x` unreachable. - let x: i32; - 'a: loop { - x = loop { continue 'a }; - } - println!("{:?}", x); -} - -fn test3() { - let x: i32; - // Similarly, the use of variable `x` is unreachable. - 'a: loop { - x = loop { return }; - } - println!("{:?}", x); -} - -fn main() { -} diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr deleted file mode 100644 index f9d94b681..000000000 --- a/src/test/ui/loops/loop-proper-liveness.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0381]: used binding `x` isn't initialized - --> $DIR/loop-proper-liveness.rs:9:22 - | -LL | let x: i32; - | - binding declared here but left uninitialized -... -LL | println!("{:?}", x); - | ^ `x` used here but it isn't initialized - | - = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider assigning a value - | -LL | let x: i32 = 0; - | +++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0381`. diff --git a/src/test/ui/loops/loop-properly-diverging-2.rs b/src/test/ui/loops/loop-properly-diverging-2.rs deleted file mode 100644 index 97b3972c1..000000000 --- a/src/test/ui/loops/loop-properly-diverging-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn forever2() -> i32 { - let x: i32 = loop { break }; //~ ERROR mismatched types - x -} - -fn main() {} diff --git a/src/test/ui/loops/loop-properly-diverging-2.stderr b/src/test/ui/loops/loop-properly-diverging-2.stderr deleted file mode 100644 index 5030a2935..000000000 --- a/src/test/ui/loops/loop-properly-diverging-2.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/loop-properly-diverging-2.rs:2:23 - | -LL | let x: i32 = loop { break }; - | ^^^^^ - | | - | expected `i32`, found `()` - | help: give it a value of the expected type: `break 42` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. |