This creates a new test directory, `ui/consts/control-flow` to hold tests related to control flow in a const context. It also blesses all existing tests with the new error messages, and adds new tests for the `const_if_match` feature.
14 lines
429 B
Rust
14 lines
429 B
Rust
fn main() {
|
|
|_: [_; return || {}] | {};
|
|
//~^ ERROR return statement outside of function body
|
|
|
|
[(); return || {}];
|
|
//~^ ERROR return statement outside of function body
|
|
|
|
[(); return |ice| {}];
|
|
//~^ ERROR return statement outside of function body
|
|
|
|
[(); return while let Some(n) = Some(0) {}];
|
|
//~^ ERROR return statement outside of function body
|
|
//~| ERROR `while` is not allowed in a `const`
|
|
}
|