about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-02 03:44:00 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-08-20 02:38:02 +0200
commitb0d47829489d44512c01868d6985cf1e86de3673 (patch)
tree747bcc6de911cfcc61dadf8be1eb1c935721e422
parentc1b08dd26036e14f061b99b20cd6f169e29046f3 (diff)
downloadrust-b0d47829489d44512c01868d6985cf1e86de3673.tar.gz
rust-b0d47829489d44512c01868d6985cf1e86de3673.zip
Stabilize 'async_await'.
-rw-r--r--src/librustc/error_codes.rs2
-rw-r--r--src/librustc_typeck/check/mod.rs2
-rw-r--r--src/librustc_typeck/error_codes.rs7
-rw-r--r--src/libstd/keyword_docs.rs2
-rw-r--r--src/libsyntax/feature_gate.rs19
5 files changed, 4 insertions, 28 deletions
diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs
index b3eee7c3464..a200a058f4f 100644
--- a/src/librustc/error_codes.rs
+++ b/src/librustc/error_codes.rs
@@ -2088,7 +2088,6 @@ generator can be constructed.
 Erroneous code example:
 
 ```edition2018,compile-fail,E0698
-#![feature(async_await)]
 async fn bar<T>() -> () {}
 
 async fn foo() {
@@ -2101,7 +2100,6 @@ To fix this you must bind `T` to a concrete type such as `String`
 so that a generator can then be constructed:
 
 ```edition2018
-#![feature(async_await)]
 async fn bar<T>() -> () {}
 
 async fn foo() {
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index fc1ee649e28..9c7ac83e82e 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -4197,8 +4197,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// A possible error is to forget to add `.await` when using futures:
     ///
     /// ```
-    /// #![feature(async_await)]
-    ///
     /// async fn make_u32() -> u32 {
     ///     22
     /// }
diff --git a/src/librustc_typeck/error_codes.rs b/src/librustc_typeck/error_codes.rs
index ca9ce3d22b5..b52183d4b1b 100644
--- a/src/librustc_typeck/error_codes.rs
+++ b/src/librustc_typeck/error_codes.rs
@@ -4751,7 +4751,6 @@ E0733: r##"
 Recursion in an `async fn` requires boxing. For example, this will not compile:
 
 ```edition2018,compile_fail,E0733
-#![feature(async_await)]
 async fn foo(n: usize) {
     if n > 0 {
         foo(n - 1).await;
@@ -4763,12 +4762,11 @@ To achieve async recursion, the `async fn` needs to be desugared
 such that the `Future` is explicit in the return type:
 
 ```edition2018,compile_fail,E0720
-# #![feature(async_await)]
 use std::future::Future;
-fn foo_desugered(n: usize) -> impl Future<Output = ()> {
+fn foo_desugared(n: usize) -> impl Future<Output = ()> {
     async move {
         if n > 0 {
-            foo_desugered(n - 1).await;
+            foo_desugared(n - 1).await;
         }
     }
 }
@@ -4777,7 +4775,6 @@ fn foo_desugered(n: usize) -> impl Future<Output = ()> {
 Finally, the future is wrapped in a pinned box:
 
 ```edition2018
-# #![feature(async_await)]
 use std::future::Future;
 use std::pin::Pin;
 fn foo_recursive(n: usize) -> Pin<Box<dyn Future<Output = ()>>> {
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs
index f5018485ef7..85a9dea09ed 100644
--- a/src/libstd/keyword_docs.rs
+++ b/src/libstd/keyword_docs.rs
@@ -984,7 +984,6 @@ mod where_keyword { }
 
 // 2018 Edition keywords
 
-#[unstable(feature = "async_await", issue = "50547")]
 #[doc(keyword = "async")]
 //
 /// Return a [`Future`] instead of blocking the current thread.
@@ -995,7 +994,6 @@ mod where_keyword { }
 /// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
 mod async_keyword { }
 
-#[unstable(feature = "async_await", issue = "50547")]
 #[doc(keyword = "await")]
 //
 /// Suspend execution until the result of a [`Future`] is ready.
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index bbc3ae28225..bce0b07db1c 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -461,9 +461,6 @@ declare_features! (
     // Allows using `#[doc(keyword = "...")]`.
     (active, doc_keyword, "1.28.0", Some(51315), None),
 
-    // Allows async and await syntax.
-    (active, async_await, "1.28.0", Some(50547), None),
-
     // Allows reinterpretation of the bits of a value of one type as another type during const eval.
     (active, const_transmute, "1.29.0", Some(53605), None),
 
@@ -857,6 +854,8 @@ declare_features! (
     (accepted, repr_align_enum, "1.37.0", Some(57996), None),
     // Allows `const _: TYPE = VALUE`.
     (accepted, underscore_const_names, "1.37.0", Some(54912), None),
+    // Allows free and inherent `async fn`s, `async` blocks, and `<expr>.await` expressions.
+    (accepted, async_await, "1.38.0", Some(50547), None),
 
     // -------------------------------------------------------------------------
     // feature-group-end: accepted features
@@ -2100,12 +2099,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                                     "labels on blocks are unstable");
                 }
             }
-            ast::ExprKind::Async(..) => {
-                gate_feature_post!(&self, async_await, e.span, "async blocks are unstable");
-            }
-            ast::ExprKind::Await(_) => {
-                gate_feature_post!(&self, async_await, e.span, "async/await is unstable");
-            }
             _ => {}
         }
         visit::walk_expr(self, e)
@@ -2154,11 +2147,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                 span: Span,
                 _node_id: NodeId) {
         if let Some(header) = fn_kind.header() {
-            // Check for const fn and async fn declarations.
-            if header.asyncness.node.is_async() {
-                gate_feature_post!(&self, async_await, span, "async fn is unstable");
-            }
-
             // Stability of const fn methods are covered in
             // `visit_trait_item` and `visit_impl_item` below; this is
             // because default methods don't pass through this point.
@@ -2198,9 +2186,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                 if block.is_none() {
                     self.check_abi(sig.header.abi, ti.span);
                 }
-                if sig.header.asyncness.node.is_async() {
-                    gate_feature_post!(&self, async_await, ti.span, "async fn is unstable");
-                }
                 if sig.decl.c_variadic {
                     gate_feature_post!(&self, c_variadic, ti.span,
                                        "C-variadic functions are unstable");