Added proper explanation error code E0696
This commit is contained in:
parent
20fc02f836
commit
e5b68bc719
3 changed files with 52 additions and 2 deletions
|
|
@ -386,6 +386,7 @@ E0691: include_str!("./error_codes/E0691.md"),
|
|||
E0692: include_str!("./error_codes/E0692.md"),
|
||||
E0693: include_str!("./error_codes/E0693.md"),
|
||||
E0695: include_str!("./error_codes/E0695.md"),
|
||||
E0696: include_str!("./error_codes/E0696.md"),
|
||||
E0697: include_str!("./error_codes/E0697.md"),
|
||||
E0698: include_str!("./error_codes/E0698.md"),
|
||||
E0699: include_str!("./error_codes/E0699.md"),
|
||||
|
|
@ -602,7 +603,6 @@ E0751: include_str!("./error_codes/E0751.md"),
|
|||
E0687, // in-band lifetimes cannot be used in `fn`/`Fn` syntax
|
||||
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
|
||||
// E0694, // an unknown tool name found in scoped attributes
|
||||
E0696, // `continue` pointing to a labeled block
|
||||
// E0702, // replaced with a generic attribute input check
|
||||
// E0707, // multiple elided lifetimes used in arguments of `async fn`
|
||||
// E0709, // multiple different lifetimes used in arguments of `async fn`
|
||||
|
|
|
|||
49
src/librustc_error_codes/error_codes/E0696.md
Normal file
49
src/librustc_error_codes/error_codes/E0696.md
Normal file
|
|
@ -0,0 +1,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!
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -21,4 +21,5 @@ LL | continue;
|
|||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0695`.
|
||||
Some errors have detailed explanations: E0695, E0696.
|
||||
For more information about an error, try `rustc --explain E0695`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue