| Control-flow expressions are not allowed inside a const context. |
| |
| At the moment, `if` and `match`, as well as the looping constructs `for`, |
| `while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`. |
| |
| ```compile_fail,E0658 |
| const _: i32 = { |
| let mut x = 0; |
| loop { |
| x += 1; |
| if x == 4 { |
| break; |
| } |
| } |
| x |
| }; |
| ``` |
| |
| This will be allowed at some point in the future, but the implementation is not |
| yet complete. See the tracking issue for [conditionals] or [loops] in a const |
| context for the current status. |
| |
| [conditionals]: https://github.com/rust-lang/rust/issues/49146 |
| [loops]: https://github.com/rust-lang/rust/issues/52000 |