rust/tests/ui/typeck/issue-114529-illegal-break-...

27 lines
591 B
Rust

// Regression test for issue #114529
// Tests that we do not ICE during const eval for a
// break-with-value in contexts where it is illegal
#[allow(while_true)]
fn main() {
[(); {
while true {
break 9; //~ ERROR `break` with value from a `while` loop
};
51
}];
[(); {
while let Some(v) = Some(9) {
break v; //~ ERROR `break` with value from a `while` loop
};
51
}];
while true {
break (|| { //~ ERROR `break` with value from a `while` loop
let local = 9;
});
}
}