]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/issue-62272.rs
ty: convert `ErrorHandled::Reported` to `ConstKind::Error`.
[rust.git] / src / test / ui / consts / const-eval / issue-62272.rs
1 // `loop`s unconditionally-broken-from used to be allowed in constants, but are now forbidden by
2 // the HIR const-checker.
3 //
4 // See https://github.com/rust-lang/rust/pull/66170 and
5 // https://github.com/rust-lang/rust/issues/62272.
6
7 const FOO: () = loop { break; }; //~ ERROR `loop` is not allowed in a `const`
8
9 fn main() {
10     [FOO; { let x; loop { x = 5; break; } x }]; //~ ERROR `loop` is not allowed in a `const`
11 }