about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-15 01:28:28 +0000
committerbors <bors@rust-lang.org>2019-12-15 01:28:28 +0000
commitfc6b5d6efe163060bde31cc1c801086ed7ebc8f1 (patch)
treeaf12b3b107ab3059dc240c1a913e9b8068ed0577 /src/librustc_error_codes/error_codes
parent6f829840f7e5897745bc7b5ff951b006a2c4e0e3 (diff)
parentfaa52d1cdaa8806201d56484df0c45bf550bf565 (diff)
downloadrust-fc6b5d6efe163060bde31cc1c801086ed7ebc8f1.tar.gz
rust-fc6b5d6efe163060bde31cc1c801086ed7ebc8f1.zip
Auto merge of #67216 - ecstatic-morse:const-loop, r=oli-obk
Enable `loop` and `while` in constants behind a feature flag

This PR is an initial implementation of #52000. It adds a `const_loop` feature gate, which allows `while` and `loop` expressions through both HIR and MIR const-checkers if enabled. `for` expressions remain forbidden by the HIR const-checker, since they desugar to a call to `IntoIterator::into_iter`, which will be rejected anyways.

`while` loops also require [`#![feature(const_if_match)]`](https://github.com/rust-lang/rust/pull/66507), since they have a conditional built into them. The diagnostics from the HIR const checker will suggest this to the user.

r? @oli-obk
cc @rust-lang/wg-const-eval
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0744.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_error_codes/error_codes/E0744.md b/src/librustc_error_codes/error_codes/E0744.md
index b299102fd69..602fbc50a71 100644
--- a/src/librustc_error_codes/error_codes/E0744.md
+++ b/src/librustc_error_codes/error_codes/E0744.md
@@ -3,7 +3,7 @@ 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
+```compile_fail,E0658
 const _: i32 = {
     let mut x = 0;
     loop {