blob: fc32d1cc5f7983f380e9640f349c8b9d0206c287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
A function is using `continue` keyword incorrectly.
Erroneous code example:
```compile_fail,E0696
fn continue_simple() {
'b: {
continue; // error!
}
}
fn continue_labeled() {
'b: {
continue 'b; // error!
}
}
fn continue_crossing() {
loop {
'b: {
continue; // error!
}
}
}
```
Here we have used the `continue` keyword incorrectly. As we
have seen above that `continue` pointing to a labeled block.
To fix this we have to use the labeled block properly.
For example:
```
fn continue_simple() {
'b: loop {
continue ; // ok!
}
}
fn continue_labeled() {
'b: loop {
continue 'b; // ok!
}
}
fn continue_crossing() {
loop {
'b: loop {
continue; // ok!
}
}
}
```
|