Skip to content

Commit

Permalink
Update error code description
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Jul 29, 2021
1 parent 550948c commit c5a29f9
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions compiler/rustc_error_codes/src/error_codes/E0744.md
Expand Up @@ -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

0 comments on commit c5a29f9

Please sign in to comment.