summary refs log tree commit diff
path: root/src/libsyntax/feature_gate.rs
diff options
context:
space:
mode:
authorTaylor Cramer <cramertj@google.com>2018-06-06 15:50:59 -0700
committerTaylor Cramer <cramertj@google.com>2018-06-21 22:36:36 -0700
commitcf844b547dbec1f23982fca8e07ec65800ed5d6d (patch)
treea5420599dea5829f105d2a12bb14a3102141a749 /src/libsyntax/feature_gate.rs
parent589446e19cbf7a2c7eddf80b490992d31134015c (diff)
downloadrust-cf844b547dbec1f23982fca8e07ec65800ed5d6d.tar.gz
rust-cf844b547dbec1f23982fca8e07ec65800ed5d6d.zip
async await desugaring and tests
Diffstat (limited to 'src/libsyntax/feature_gate.rs')
-rw-r--r--src/libsyntax/feature_gate.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index a9679f86ddb..ccb2f51f964 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -308,7 +308,7 @@ declare_features! (
     // Declarative macros 2.0 (`macro`).
     (active, decl_macro, "1.17.0", Some(39412), None),
 
-    // Allows #[link(kind="static-nobundle"...]
+    // Allows #[link(kind="static-nobundle"...)]
     (active, static_nobundle, "1.16.0", Some(37403), None),
 
     // `extern "msp430-interrupt" fn()`
@@ -474,7 +474,7 @@ declare_features! (
     (active, doc_keyword, "1.28.0", Some(51315), None),
 
     // Allows async and await syntax
-    (active, async_await, "1.28.0", Some(0), Some(Edition::Edition2018)),
+    (active, async_await, "1.28.0", Some(50547), None),
 );
 
 declare_features! (
@@ -1722,6 +1722,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                                     "labels on blocks are unstable");
                 }
             }
+            ast::ExprKind::Closure(_, ast::IsAsync::Async(_), ..) => {
+                gate_feature_post!(&self, async_await, e.span, "async closures are unstable");
+            }
+            ast::ExprKind::Async(..) => {
+                gate_feature_post!(&self, async_await, e.span, "async blocks are unstable");
+            }
             _ => {}
         }
         visit::walk_expr(self, e);
@@ -1764,7 +1770,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
         match fn_kind {
             FnKind::ItemFn(_, header, _, _) => {
                 // check for const fn and async fn declarations
-                if header.asyncness == ast::IsAsync::Async {
+                if header.asyncness.is_async() {
                     gate_feature_post!(&self, async_await, span, "async fn is unstable");
                 }
                 if header.constness.node == ast::Constness::Const {