rust/tests/ui/loops/loop-else-break-with-value.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
340 B
Rust
Raw Normal View History

2023-02-24 03:12:01 +08:00
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;
};
}