Skip to content

Commit 0bc04e3

Browse files
Update E0744 about control flow in const contexts to reflect the current status of const fn.
This is a squash of these commits: - Update E0744 about control flow in `const` contexts to reflect current status of `const fn`. - E0744 isn't just about `for` loops or control flow - Fix formatting on E0744 cause my editor decided to not copy it well - Improve wording - Fix a markdown formatting error - Fix E0744's description as I interpreted some code wrong - Fix a minor wording issue again - Add a few more links to blocking issues - Improve links to tracking issues
1 parent f5230fb commit 0bc04e3

File tree

1 file changed

+11
-8
lines changed
  • compiler/rustc_error_codes/src/error_codes

1 file changed

+11
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A control-flow expression was used inside a const context.
1+
An unsupported expression was used inside a const context.
22

33
Erroneous code example:
44

@@ -12,12 +12,15 @@ const _: i32 = {
1212
};
1313
```
1414

15-
At the moment, `if` and `match`, as well as the looping constructs `for`,
16-
`while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`.
15+
At the moment, `for` loops, `.await`, and the `Try` operator (`?`) are forbidden
16+
inside a `const`, `static`, or `const fn`.
1717

18-
This will be allowed at some point in the future, but the implementation is not
19-
yet complete. See the tracking issue for [conditionals] or [loops] in a const
20-
context for the current status.
18+
This may be allowed at some point in the future, but the implementation is not
19+
yet complete. See the tracking issues for [`async`] and [`?`] in `const fn`, and
20+
(to support `for` loops in `const fn`) the tracking issues for [`impl const
21+
Trait for Ty`] and [`&mut T`] in `const fn`.
2122

22-
[conditionals]: https://github.com/rust-lang/rust/issues/49146
23-
[loops]: https://github.com/rust-lang/rust/issues/52000
23+
[`async`]: https://github.com/rust-lang/rust/issues/69431
24+
[`?`]: https://github.com/rust-lang/rust/issues/74935
25+
[`impl const Trait for Ty`]: https://github.com/rust-lang/rust/issues/67792
26+
[`&mut T`]: https://github.com/rust-lang/rust/issues/57349

0 commit comments

Comments
 (0)