Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Nested macro with attribute internal_macro_calls requires increasing in case of nested macro calls #43

Open
olegnn opened this issue Oct 3, 2019 · 1 comment

Comments

@olegnn
Copy link
Contributor

olegnn commented Oct 3, 2019

I'm very sorry to worry you again, but the problem with nested macros still exists.
For now, there's no way to invoke nested macro in nested macro without increasing internal_macro_calls. In example below this value in join_all! macro attribute is 5 because in code

#[proc_macro_hack(support_nested, internal_macro_calls = 5)]
pub use proc_macro_hack_bug_impl::join_all;

async fn add_nested_custom_joined_results() -> usize {
    let results = join_all!(ready(join_all!(ready(7usize)).0), ready(join_all!(ready(8usize)).0), ready(join_all!(ready(join_all!(ready(9usize)).0)).0));
    results.0 + results.1 + results.2
}

we have 5 calls of join_all! macro each of which inserts 1 nested join! macro. Of course this problem can be solved by setting internal_macro_calls to maximum value, but...

Unfortunately, in situation with join_all_x2! even value of 60 doesn't help. ===> https://github.com/olegnn/proc_macro_hack_bug

@olegnn olegnn changed the title Nested macros with attribute internal_macro_calls requires increasing in case of nested macro calls Nested macro with attribute internal_macro_calls requires increasing in case of nested macro calls Oct 3, 2019
@dtolnay
Copy link
Owner

dtolnay commented Oct 3, 2019

I don't know of a way to fix this unfortunately, but I would accept a PR if anyone comes up with something.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants