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