error outside-loop
break или continue вне цикла.
What it means#
break and continue are valid only inside the body of for, while or loop (§5.6), within the same function. A closure body is a new function and does not inherit the loop.
Example#
fn main() {
let done = true
if done { break } // <- outside-loop
}error
outside-loop
How to fix#
fn main() {
loop {
let done = true
if done { break }
}
}Move the statement into a loop, or use return to leave the function.