error bad-label
What it means#
break 'name and continue 'name must refer to a label of an enclosing loop, introduced as 'name: for ... (§1.3, §5.6).
Example#
fn main() {
for a in [1, 2] {
for b in [1, 2] {
if a == b { break 'outer } // <- bad-label
}
}
}error
bad-label
How to fix#
fn main() {
'outer: for a in [1, 2] {
for b in [1, 2] {
if a == b { break 'outer }
}
}
}Declare the label on the outer loop, or correct its name.