Skip to content
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

tokio-macros 1.8.1 regression #5243

Closed
taiki-e opened this issue Nov 29, 2022 · 2 comments · Fixed by #5244
Closed

tokio-macros 1.8.1 regression #5243

taiki-e opened this issue Nov 29, 2022 · 2 comments · Fixed by #5244
Assignees
Labels
A-tokio-macros Area: The tokio-macros crate

Comments

@taiki-e
Copy link
Member

taiki-e commented Nov 29, 2022

NOTE(taiki-e): I yanked 1.8.1 for now.


I have a suspicion that this cause an interesting regression, but I'm not certain.

In our codebase, we have something along the lines of

macro_rules! custom_test {
    (async fn $name:ident() $b:block) => {
        #[::tokio::test]
        async fn $name() {
            dbg!("foo");
            $b
        }
    };
}

// usage normally with macro_rules_attribute, but for demonstration
custom_test!(
    async fn foo() {
        dbg!("bar");
    }
);

This compiles with tokio-macros 1.8.0 but does not with 1.8.1

error[E0425]: cannot find value `body` in this scope
  --> tests/main.rs:74:20
   |
74 |       async fn foo() {
   |  ____________________^
75 | |         dbg!("bar");
76 | |     }
   | |_____^ not found in this scope

Originally posted by @conradludgate in #5092 (comment)

@taiki-e
Copy link
Member Author

taiki-e commented Nov 29, 2022

This issue reminds me of dtolnay/async-trait#104...

@taiki-e
Copy link
Member Author

taiki-e commented Nov 29, 2022

Filed #5244 to fix this.

@taiki-e taiki-e added the A-tokio-macros Area: The tokio-macros crate label Nov 29, 2022
@taiki-e taiki-e self-assigned this Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-macros Area: The tokio-macros crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant