Skip to content

Commit f685142

Browse files
committed
async can begin expressions
1 parent 11f812a commit f685142

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/libsyntax/parse/token.rs

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub(crate) fn ident_can_begin_expr(ident: ast::Ident, is_raw: bool) -> bool {
104104
!ident_token.is_reserved_ident() ||
105105
ident_token.is_path_segment_keyword() ||
106106
[
107+
keywords::Async.name(),
107108
keywords::Do.name(),
108109
keywords::Box.name(),
109110
keywords::Break.name(),

src/test/ui/async-matches-expr.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-pass
12+
// edition:2018
13+
14+
#![feature(async_await, await_macro)]
15+
16+
macro_rules! match_expr {
17+
($x:expr) => {}
18+
}
19+
20+
fn main() {
21+
match_expr!(async {});
22+
match_expr!(async || {});
23+
}

0 commit comments

Comments
 (0)