-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile error mixing declarative macros with #[tokio::test]
#3579
Labels
Comments
incidental-complexity
added
C-bug
Category: This is a bug.
A-tokio
Area: The main tokio crate
labels
Mar 4, 2021
Darksonn
added
A-tokio-macros
Area: The tokio-macros crate
and removed
A-tokio
Area: The main tokio crate
labels
Mar 4, 2021
I strongly doubt Tokio can do anything about this. You can fix it with an extra set of parenthesises. #[tokio::test]
async fn async_test() {
$crate::test_suite::async_test(($foo_factory)()).await;
} |
Cross posted with rust-lang |
Kestrer
added a commit
to Kestrer/tokio
that referenced
this issue
Mar 5, 2021
When user-generated token streams are returned from proc macros, all none-delimited groups are flattened. This can cause compilation errors as shown in the issue below. By instead passing the function body token stream straight through from the input of the proc macro to its output, it does not get deconstructed and reconstructed, and so the none-delimited groups are not lost. Fixes: tokio-rs#3579
Kestrer
added a commit
to Kestrer/tokio
that referenced
this issue
Mar 5, 2021
When user-generated token streams are returned from proc macros, all none-delimited groups are flattened. This can cause compilation errors as shown in the issue below. By instead passing the function body token stream straight through from the input of the proc macro to its output, it does not get deconstructed and reconstructed, and so the none-delimited groups are not lost. Fixes: tokio-rs#3579
Kestrer
added a commit
to Kestrer/tokio
that referenced
this issue
Mar 5, 2021
When user-generated token streams are returned from proc macros, all none-delimited groups are flattened. This can cause compilation errors as shown in the issue below. By instead passing the function body token stream straight through from the input of the proc macro to its output, it does not get deconstructed and reconstructed, and so the none-delimited groups are not lost. Fixes: tokio-rs#3579
Thoughts @taiki-e ? |
Looks like this is a regression introduced in Rust 1.49.0 (it works with all versions of 1.45 to 1.48.), see rust-lang/rust#82784 (comment) for more. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is reproducible in the playground:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fb6d73cfb878547b438d8ec49431a4d2
concrete_tests2
andconcrete_tests3
compile whereasconcrete_tests1
does not.I'm producing a declarative macro that takes in an
expr
that is meant to be a closure, and produces a#[tokio::test]
that invokes that closure. The compile error is:The code (from the playground link above) is:
The text was updated successfully, but these errors were encountered: