Add E0744 for control flow in consts
This commit is contained in:
parent
695fe96517
commit
8b7d2bc270
1 changed files with 22 additions and 0 deletions
|
@ -626,6 +626,28 @@ async fn foo() {}
|
||||||
Switch to the Rust 2018 edition to use `async fn`.
|
Switch to the Rust 2018 edition to use `async fn`.
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
|
E0744: r##"
|
||||||
|
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,E0744
|
||||||
|
const _: {
|
||||||
|
let mut x = 0;
|
||||||
|
loop {
|
||||||
|
x += 1;
|
||||||
|
if x == 4 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
"##,
|
||||||
|
|
||||||
;
|
;
|
||||||
E0226, // only a single explicit lifetime bound is permitted
|
E0226, // only a single explicit lifetime bound is permitted
|
||||||
E0472, // asm! is unsupported on this target
|
E0472, // asm! is unsupported on this target
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue