-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse
.await
inside of macro invocation
- Loading branch information
Showing
4 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// compile-fail | ||
|
||
#![deny(warnings)] | ||
#![feature(async_await, generators)] | ||
|
||
use futures_async_stream::async_stream; | ||
|
||
macro_rules! foo { | ||
($($tt:tt)*) => { | ||
$($tt)* | ||
}; | ||
} | ||
|
||
#[async_stream(item = i32)] | ||
pub async fn inside_of_macro_invocation() { | ||
foo!(yield 0); | ||
foo!(yield foo!(async { 1 }.await,)); | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error: macro expansion ignores token `,` and any following | ||
--> $DIR/macro-invocation.rs:17:38 | ||
| | ||
17 | foo!(yield foo!(async { 1 }.await,)); | ||
| ----------------------^-- help: you might be missing a semicolon here: `;` | ||
| | | ||
| caused by the macro expansion here | ||
| | ||
= note: the usage of `foo!` is likely invalid in expression context | ||
|
||
error: aborting due to previous error | ||
|