about summary refs log tree commit diff
path: root/src/libsyntax/util
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-23 09:02:45 +0000
committerbors <bors@rust-lang.org>2018-06-23 09:02:45 +0000
commit56e8f29dbe89f2109cacc8eb5e92ea3de32eefb9 (patch)
tree8630b3d600677d35ce9c956fbfe12923b57e302d /src/libsyntax/util
parent2ea922a96d676ff84cd78421d314e6aac305b5e9 (diff)
parent30c17ccbffdbb88020e6ed42d89cc214fc3e6e5f (diff)
downloadrust-56e8f29dbe89f2109cacc8eb5e92ea3de32eefb9.tar.gz
rust-56e8f29dbe89f2109cacc8eb5e92ea3de32eefb9.zip
Auto merge of #51580 - cramertj:async-await, r=eddyb
async/await

This PR implements `async`/`await` syntax for `async fn` in Rust 2015 and `async` closures and `async` blocks in Rust 2018 (tracking issue: https://github.com/rust-lang/rust/issues/50547). Limitations: non-`move` async closures with arguments are currently not supported, nor are `async fn` with multiple different input lifetimes. These limitations are not fundamental and will be removed in the future, however I'd like to go ahead and get this PR merged so we can start experimenting with this in combination with futures 0.3.

Based on https://github.com/rust-lang/rust/pull/51414.
cc @petrochenkov for parsing changes.
r? @eddyb
Diffstat (limited to 'src/libsyntax/util')
-rw-r--r--src/libsyntax/util/parser.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs
index 51b535275d6..15d910b33b0 100644
--- a/src/libsyntax/util/parser.rs
+++ b/src/libsyntax/util/parser.rs
@@ -277,6 +277,7 @@ pub enum ExprPrecedence {
     Block,
     Catch,
     Struct,
+    Async,
 }
 
 impl PartialOrd for ExprPrecedence {
@@ -346,6 +347,7 @@ impl ExprPrecedence {
             ExprPrecedence::Match |
             ExprPrecedence::Block |
             ExprPrecedence::Catch |
+            ExprPrecedence::Async |
             ExprPrecedence::Struct => PREC_PAREN,
         }
     }