Skip to content

Commit 013e4da

Browse files
authored
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); // ^^^^^^^^^
2 parents 250fe9b + 1ea7c5f commit 013e4da

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/libsyntax/parse/parser.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2635,6 +2635,7 @@ impl<'a> Parser<'a> {
26352635
self.expect(&token::OpenDelim(token::Paren))?;
26362636
let expr = self.parse_expr()?;
26372637
self.expect(&token::CloseDelim(token::Paren))?;
2638+
hi = self.prev_span;
26382639
ex = ExprKind::Await(ast::AwaitOrigin::MacroLike, expr);
26392640
} else if self.token.is_path_start() {
26402641
let path = self.parse_path(PathStyle::Expr)?;

src/test/ui/feature-gate/await-macro.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0658]: `await!(<expr>)` macro syntax is unstable, and will soon be remove
22
--> $DIR/await-macro.rs:9:5
33
|
44
LL | await!(bar());
5-
| ^^^^^
5+
| ^^^^^^^^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/50547
88
= help: add #![feature(await_macro)] to the crate attributes to enable

0 commit comments

Comments
 (0)