-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Re-exported concat macro causes "failed to resolve macro" error #10300
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
Mostly this is to avoid rust-lang/rust-analyzer#10300, though the result is overall better anyway.
Reduces to: mod private {
pub use core::concat;
}
macro_rules! m {
() => {
panic!(concat!($crate::private::concat!("")));
};
}
fn f() {
m!();
} Might be caused by a limitation in our |
Can't reproduce it. |
Hm, strange. I am using v0.2.817 (~1 hour ago at time of writing) and still reproducing the issue. Am I incorrectly updated? |
No, I can still repro with both snippets in this thread |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
11354: fix: More correct `$crate` handling in eager macros r=jonas-schievink a=jonas-schievink Fixes a few of the additional bugs in #10300, but not yet that issue itself. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Minimal example, reduced from a larger macro:
As is, this is valid code that compiles. However, rust analyzer emits "failed to resolve macro" at expansion B.
Furthermore, as noted one can use
println!
and neither expansion has an error, or switch toassert!
and get an error at both expansions. In all cases there is no actual error during rustc compilation.(The use of re-exported
concat
in the private module is to avoid call-site environment pollution in the macro expansion.)Let me know if this is unclear or if I've made an error along the way. Thanks!
The text was updated successfully, but these errors were encountered: