Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2628,7 +2628,8 @@ impl<'a> Parser<'a> {
db.span_label(self.span, "expected expression");
db.note("variable declaration using `let` is a statement");
return Err(db);
} else if self.span.rust_2018() && self.eat_keyword(keywords::Await) {
} else if self.span.rust_2018() && self.eat_keyword(keywords::Await)
&& self.check(&token::Not) {
// FIXME: remove this branch when `await!` is no longer supported
// https://github.com/rust-lang/rust/issues/60610
self.expect(&token::Not)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ macro_rules! await {
}

fn main() {
match await { await => () } //~ ERROR expected `!`, found `{`
match await { await => () } //~ ERROR expected expression, found `{`
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ help: you can escape reserved keywords to use them as identifiers
LL | macro_rules! r#await {
| ^^^^^^^

error: expected `!`, found `{`
error: expected expression, found `{`
--> $DIR/2018-edition-error-in-non-macro-position.rs:26:17
|
LL | match await { await => () }
| ----- ^ expected `!`
| ----- ^ expected expression
| |
| while parsing this match expression

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/await-keyword/2018-edition-error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ use self::outer_mod::await::await; //~ ERROR expected identifier
//~^ ERROR expected identifier, found reserved keyword `await`

fn main() {
match await { await => () } //~ ERROR expected `!`, found `{`
match await { await => () } //~ ERROR expected expression, found `{`
}
4 changes: 2 additions & 2 deletions src/test/ui/await-keyword/2018-edition-error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ help: you can escape reserved keywords to use them as identifiers
LL | use self::outer_mod::await::r#await;
| ^^^^^^^

error: expected `!`, found `{`
error: expected expression, found `{`
--> $DIR/2018-edition-error.rs:13:17
|
LL | match await { await => () }
| ----- ^ expected `!`
| ----- ^ expected expression
| |
| while parsing this match expression

Expand Down