summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval/issue-62272.rs
blob: 19abd91252db9725abc28b2a6e80bd58383b9625 (plain)
1
2
3
4
5
6
7
8
9
10
11
// `loop`s unconditionally-broken-from used to be allowed in constants, but are now forbidden by
// the HIR const-checker.
//
// See https://github.com/rust-lang/rust/pull/66170 and
// https://github.com/rust-lang/rust/issues/62272.

const FOO: () = loop { break; }; //~ ERROR `loop` is not allowed in a `const`

fn main() {
    [FOO; { let x; loop { x = 5; break; } x }]; //~ ERROR `loop` is not allowed in a `const`
}