]>
Commit | Line | Data |
---|---|---|
f035d41b XL |
1 | An unreachable label was used. |
2 | ||
3 | Erroneous code example: | |
4 | ||
5 | ```compile_fail,E0767 | |
6 | 'a: loop { | |
7 | || { | |
8 | loop { break 'a } // error: use of unreachable label `'a` | |
9 | }; | |
10 | } | |
11 | ``` | |
12 | ||
13 | Ensure that the label is within scope. Labels are not reachable through | |
14 | functions, closures, async blocks or modules. Example: | |
15 | ||
16 | ``` | |
17 | 'a: loop { | |
18 | break 'a; // ok! | |
19 | } | |
20 | ``` |