Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
31 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|