mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Update error code description
This commit is contained in:
parent
550948c553
commit
c5a29f9245
@ -2,25 +2,15 @@ An unsupported expression was used inside a const context.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0744
|
||||
```compile_fail,edition2018,E0744
|
||||
const _: i32 = {
|
||||
let mut x = 0;
|
||||
|
||||
for i in 0..4 { // error!
|
||||
x += i;
|
||||
}
|
||||
async { 0 }.await
|
||||
};
|
||||
```
|
||||
|
||||
At the moment, `for` loops, `.await`, and the `Try` operator (`?`) are forbidden
|
||||
inside a `const`, `static`, or `const fn`.
|
||||
At the moment, `.await` is forbidden inside a `const`, `static`, or `const fn`.
|
||||
|
||||
This may be allowed at some point in the future, but the implementation is not
|
||||
yet complete. See the tracking issues for [`async`] and [`?`] in `const fn`, and
|
||||
(to support `for` loops in `const fn`) the tracking issues for [`impl const
|
||||
Trait for Ty`] and [`&mut T`] in `const fn`.
|
||||
yet complete. See the tracking issue for [`async`] in `const fn`.
|
||||
|
||||
[`async`]: https://github.com/rust-lang/rust/issues/69431
|
||||
[`?`]: https://github.com/rust-lang/rust/issues/74935
|
||||
[`impl const Trait for Ty`]: https://github.com/rust-lang/rust/issues/67792
|
||||
[`&mut T`]: https://github.com/rust-lang/rust/issues/57349
|
||||
|
Loading…
Reference in New Issue
Block a user