Skip to content

Commit

Permalink
move old ui test
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Feb 24, 2023
1 parent 152a029 commit 13b8497
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
4 changes: 0 additions & 4 deletions tests/ui/let-else/let-else-brace-before-else.fixed
Expand Up @@ -7,10 +7,6 @@ fn main() {
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
return;
};
let Some(1) = (loop { break Some(1) }) else {
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
return;
};
let 2 = 1 + (match 1 { n => n }) else {
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
return;
Expand Down
4 changes: 0 additions & 4 deletions tests/ui/let-else/let-else-brace-before-else.rs
Expand Up @@ -7,10 +7,6 @@ fn main() {
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
return;
};
let Some(1) = loop { break Some(1) } else {
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
return;
};
let 2 = 1 + match 1 { n => n } else {
//~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed
return;
Expand Down
17 changes: 3 additions & 14 deletions tests/ui/let-else/let-else-brace-before-else.stderr
Expand Up @@ -10,18 +10,7 @@ LL | let Some(1) = ({ Some(1) }) else {
| + +

error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/let-else-brace-before-else.rs:10:40
|
LL | let Some(1) = loop { break Some(1) } else {
| ^
|
help: wrap the expression in parentheses
|
LL | let Some(1) = (loop { break Some(1) }) else {
| + +

error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/let-else-brace-before-else.rs:14:34
--> $DIR/let-else-brace-before-else.rs:10:34
|
LL | let 2 = 1 + match 1 { n => n } else {
| ^
Expand All @@ -32,7 +21,7 @@ LL | let 2 = 1 + (match 1 { n => n }) else {
| + +

error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/let-else-brace-before-else.rs:18:40
--> $DIR/let-else-brace-before-else.rs:14:40
|
LL | let Some(1) = unsafe { unsafe_fn() } else {
| ^
Expand All @@ -42,5 +31,5 @@ help: wrap the expression in parentheses
LL | let Some(1) = (unsafe { unsafe_fn() }) else {
| + +

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

10 changes: 10 additions & 0 deletions tests/ui/loops/loop-else-break-with-value.rs
@@ -0,0 +1,10 @@
fn main() {
let Some(1) = loop {
//~^ NOTE `else` is attached to this loop
break Some(1)
} else {
//~^ ERROR `loop...else` loops are not supported
//~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
return;
};
}
18 changes: 18 additions & 0 deletions tests/ui/loops/loop-else-break-with-value.stderr
@@ -0,0 +1,18 @@
error: `loop...else` loops are not supported
--> $DIR/loop-else-break-with-value.rs:5:7
|
LL | let Some(1) = loop {
| ---- `else` is attached to this loop
...
LL | } else {
| _______^
LL | |
LL | |
LL | | return;
LL | | };
| |_____^
|
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run

error: aborting due to previous error

0 comments on commit 13b8497

Please sign in to comment.