-
Notifications
You must be signed in to change notification settings - Fork 13k
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
ICE when passing a macro expression to a macro using it in an attribute in 1.18.0 and later #42164
Comments
I ran into this with declarative macros on pub macro m($inner_str:expr) {
#[doc = $inner_str]
struct S;
}
m!(stringify!(foo)); |
Panics with the same error on 1.18.0 stable now: https://is.gd/svv043 |
Closes rust-lang#27078. Closes rust-lang#27985. Closes rust-lang#39848. Closes rust-lang#42164. Closes rust-lang#42479. Closes rust-lang#45152. Closes rust-lang#45662. Closes rust-lang#45876. Closes rust-lang#45965.
Now this works, but it breaks proc-macro derives on the same item (parsing fails). Should I report that bug to a different location? It sort of feels like it's rustc's fault, as it's passing the proc-macro invalid syntax. I think it's odd that a macro can legally expand to invalid syntax... |
@PlasmaPower That sounds a rust-lang/rust problem, yes. Have you filed an issue? I'd love to see a short example of the failure. |
I've opened another issue for it: #47358 |
I found out that
#[export_name = concat!("external_", "name")]
doesn't work, so I got a bit creative and tried this (reduced example):Which lead to this:
It just prints an error on stable (1.17.0):
And of course:
The text was updated successfully, but these errors were encountered: