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

Macro expansion recurses endlessly? #10256

Open
Veykril opened this issue Sep 16, 2021 · 5 comments
Open

Macro expansion recurses endlessly? #10256

Veykril opened this issue Sep 16, 2021 · 5 comments
Labels
A-macro macro expansion

Comments

@Veykril
Copy link
Member

Veykril commented Sep 16, 2021

The following macro + invocation(taken from rust-lang/rust#88577 (comment)) seems to recurse endlessly(or just takes a very long time?) even emitting a warning in name res, [WARN hir_def::nameres::collector] macro expansion is too deep

macro_rules! many_args {
    ([$($t:tt)*]#$($h:tt)*) => {
        many_args!{[$($t)*$($t)*]$($h)*}
    };
    ([$($t:tt)*]) => {
        fn _f($($t: ()),*) {}
    }
}

many_args!{[_]########## ######}
@Veykril Veykril added the A-macro macro expansion label Sep 16, 2021
@WaffleLapkin
Copy link
Member

I think this is not an issue anymore, for me RA_LOG="hir_def=info" rust-analyzer analysis-stats . doesn't produce any warnings and seems to be working fine?

2022-06-05_14-17

@Veykril
Copy link
Member Author

Veykril commented Jun 5, 2022

it is giving me an expansion error now, so I assume we broke something in macro expansion again
image

@WaffleLapkin
Copy link
Member

The only thing I get is the error from rustc about too many arguments:
2022-06-05_14-41

@Veykril
Copy link
Member Author

Veykril commented Jun 5, 2022

Huh? That seems odd, are you certain you are on the latest version? (or do you have macro-error disabled in your settings perhaps)

@WaffleLapkin
Copy link
Member

WaffleLapkin commented Jun 5, 2022

r-a version: 815b43429 2022-06-05 nightly
These are all the r-a settings in vscode:

"rust-analyzer.updates.channel": "nightly",
"rust-analyzer.cargo.allFeatures": true,
"rust-analyzer.checkOnSave.enable": true,
"rust-analyzer.imports.prefix": "crate",
"rust-analyzer.cargo.buildScripts.enable": true,
"rust-analyzer.rustc.source": "discover",

Though it seems like the first two are outdated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion
Projects
None yet
Development

No branches or pull requests

2 participants