about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-30 12:05:48 +0000
committerbors <bors@rust-lang.org>2021-07-30 12:05:48 +0000
commit87dc8242484110c75596a91ebd2043a476c09839 (patch)
tree00eb86f03f25d8707dd1784052d813dcc4cb0803 /compiler/rustc_error_codes/src
parent1195bea5a7b73e079fa14b37ac7e375fc77d368a (diff)
parentc5a29f92450c5d1191754000d37611af5e19f38b (diff)
downloadrust-87dc8242484110c75596a91ebd2043a476c09839.tar.gz
rust-87dc8242484110c75596a91ebd2043a476c09839.zip
Auto merge of #87237 - jonas-schievink:const-for-and-try, r=oli-obk
Add feature gates for `for` and `?` in consts

These operations seems *relatively* straightforward to support, and only seem to be blocked on `impl const Trait`.

I have included a working test for `const_try`, but `const_for` is currently unusable without reimplementing *every single* defaulted `Iterator` method, so I didn't do that.

(both features still need tracking issues before this is merged)
Diffstat (limited to 'compiler/rustc_error_codes/src')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0744.md18
1 files changed, 4 insertions, 14 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0744.md b/compiler/rustc_error_codes/src/error_codes/E0744.md
index 45804ab266e..9a8ef3b840d 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0744.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0744.md
@@ -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