Rust errors / Everything else
Rust compiler error · checked with rustc 1.99.0
Rust error E0695: unlabeled `break` inside of a labeled block
What it meansA break statement without a label appeared inside a labeled block.
What rustc prints
error[E0695]: unlabeled `break` inside of a labeled block
--> main.rs:5:9
|
5 | break;
| ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a labelReal output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
A break statement without a label appeared inside a labeled block.
Erroneous code example:
loop {
'a: {
break;
}
}
Make sure to always label the break:
'l: loop {
'a: {
break 'l;
}
}
Or if you want to break the labeled block:
loop {
'a: {
break 'a;
}
break;
}From rustc --explain E0695 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0061this function takes N arguments but M were supplied
- E0412cannot find type in this scope
- E0515cannot return reference to local variable
- E0728await is only allowed inside async functions and blocks
- E0659`foo` is ambiguous
- E0670Rust 2015 does not permit the use of `async fn`
- E0696`continue` pointing to a labeled block
- E0703invalid ABI: found `invalid`
Up next
Often hit nextE0061: this function takes N arguments but M were suppliedA related error from the same family.Read it next →Did this answer your question?