-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ifmt
macros (using proc_macro_hack
) fail to expand
#12614
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
Comments
I can't reproduce the I'm running into two issues with ifmt: iwriteln!(code, module_header)?; gives me "unresolved import" and "unresolved macro use $crate::_proc_macro_hack_iwriteln;
#[$crate::proc_macro_fake_call_site_iwriteln(code, module_header)]
#[derive(_proc_macro_hack_iwriteln)]
#[allow(dead_code)]
enum ProcMacroHack {
Value = ("code , module_header", 0).1,
}
proc_macro_call!() and if I replace the Doing that replacement and expanding {
use ifmt::_proc_macro_hack_iwriteln;
#[derive(_proc_macro_hack_iwriteln)]
#[allow(dead_code)]
enum ProcMacroHack {
Value = ("code, module_header", 0).1,
}
proc_macro_call!()
}; (ignoring some span / hygiene stuff that hopefully doesn't matter in practice here); now {
use ifmt::_proc_macro_hack_iwriteln;
#[derive(_proc_macro_hack_iwriteln)]
#[allow(dead_code)]
enum ProcMacroHack {
Value = (stringify!(code, module_header), 0).1,
}
proc_macro_call!()
}; The above code then expands correctly. So this seems to be an issue with us expanding |
Oh, maybe the first one is because the |
@flodiebold Thanks very much for looking into this, if I can help with feedback please let me know. |
This no longer seems to error 🎉 |
I have the same issue using
ifmt
, which has theiwriteln!
macro.The error message is:
proc macro
proc_macro_fake_call_site_iwritelnnot expanded: proc macro not foundrust-analyzer
It looks like the error prints out for every usage, so 100s of times in my case.
The
use
statement is:After that all other
use
statements show errors, the repeating message above.cargo check
runs with no errors.An example usage of this macro is:
As the original report said, this used to show up sometimes and go away. Even after restarting
rust-analyzer
the spurious error remains.I must say that
rust-analyzer
has gotten so much better recently, once you get this fixed it will be awesome.Originally posted by @cisaacson in #12610 (comment)
The text was updated successfully, but these errors were encountered: