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:
|
Erroneous code example:
|
||||||
|
|
||||||
```compile_fail,E0744
|
```compile_fail,edition2018,E0744
|
||||||
const _: i32 = {
|
const _: i32 = {
|
||||||
let mut x = 0;
|
async { 0 }.await
|
||||||
|
|
||||||
for i in 0..4 { // error!
|
|
||||||
x += i;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
At the moment, `for` loops, `.await`, and the `Try` operator (`?`) are forbidden
|
At the moment, `.await` is forbidden inside a `const`, `static`, or `const fn`.
|
||||||
inside a `const`, `static`, or `const fn`.
|
|
||||||
|
|
||||||
This may be allowed at some point in the future, but the implementation is not
|
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
|
yet complete. See the tracking issue for [`async`] in `const fn`.
|
||||||
(to support `for` loops in `const fn`) the tracking issues for [`impl const
|
|
||||||
Trait for Ty`] and [`&mut T`] in `const fn`.
|
|
||||||
|
|
||||||
[`async`]: https://github.com/rust-lang/rust/issues/69431
|
[`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