diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-05-16 10:43:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-16 10:43:30 +0200 |
| commit | 013e4daa41048fb5ddf6cc3fc92421153a4e9cf4 (patch) | |
| tree | 15f7d62979f82060e333c390ca0088a4a705f460 | |
| parent | 250fe9b37e4723c92d4edc0fc5d56a7ccd36db87 (diff) | |
| parent | 1ea7c5fb2039933c67af8ba8629694733c0cd36e (diff) | |
| download | rust-013e4daa41048fb5ddf6cc3fc92421153a4e9cf4.tar.gz rust-013e4daa41048fb5ddf6cc3fc92421153a4e9cf4.zip | |
Rollup merge of #60691 - topecongiro:await-macro-span, r=Centril
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);
// ^^^^^^^^^
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/feature-gate/await-macro.stderr | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 2d6c8c54075..99e8db9d8e6 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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)?; diff --git a/src/test/ui/feature-gate/await-macro.stderr b/src/test/ui/feature-gate/await-macro.stderr index b6833655f6d..699a7a8886e 100644 --- a/src/test/ui/feature-gate/await-macro.stderr +++ b/src/test/ui/feature-gate/await-macro.stderr @@ -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 |
