]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0268.md
Rollup merge of #104401 - RalfJung:mpsc-leak, r=Amanieu
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0268.md
1 A loop keyword (`break` or `continue`) was used outside of a loop.
2
3 Erroneous code example:
4
5 ```compile_fail,E0268
6 fn some_func() {
7     break; // error: `break` outside of a loop
8 }
9 ```
10
11 Without a loop to break out of or continue in, no sensible action can be taken.
12 Please verify that you are using `break` and `continue` only in loops. Example:
13
14 ```
15 fn some_func() {
16     for _ in 0..10 {
17         break; // ok!
18     }
19 }
20 ```