Skip to content

Commit

Permalink
Rollup merge of rust-lang#60691 - topecongiro:await-macro-span, r=Cen…
Browse files Browse the repository at this point in the history
…tril

Include expression to wait for to the span of Await

Currently the span of `await!` only includes itself:

```rust
    await!(3);
//  ^^^^^
```

This PR changes it so that the span holds the whole `await!` expression:

```rust
    await!(3);
//  ^^^^^^^^^
  • Loading branch information
Centril authored May 16, 2019
2 parents 250fe9b + 1ea7c5f commit 013e4da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,7 @@ impl<'a> Parser<'a> {
self.expect(&token::OpenDelim(token::Paren))?;
let expr = self.parse_expr()?;
self.expect(&token::CloseDelim(token::Paren))?;
hi = self.prev_span;
ex = ExprKind::Await(ast::AwaitOrigin::MacroLike, expr);
} else if self.token.is_path_start() {
let path = self.parse_path(PathStyle::Expr)?;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate/await-macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0658]: `await!(<expr>)` macro syntax is unstable, and will soon be remove
--> $DIR/await-macro.rs:9:5
|
LL | await!(bar());
| ^^^^^
| ^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/50547
= help: add #![feature(await_macro)] to the crate attributes to enable
Expand Down

0 comments on commit 013e4da

Please sign in to comment.