-
Notifications
You must be signed in to change notification settings - Fork 1.7k
False macro expansion error in lazy_static_include_bytes
#11521
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
smaller repro: macro_rules! m {
(($tt:tt)) => {
stringify!($tt)
};
($vis:vis $name:ident) => {
m!(($vis))
};
}
const _: &str = m$0!(foo); Turns out |
🙊 |
Ye I don't think there is much we can do here right now? I assume rust doesn't need to convert intermediate expansions back into proper ASTs like we do 😬 so this requires us to have an empty ast node or something similar. I demand a |
Oh now thinking about that, it makes a lot of sense that it works this way, since macro captures that arent |
I think modifying syntax trees is ok: we support One worry I have is that we lightly enforce an invariat that there are no nodes of length zero, and, if we allow them, I expect a tonne of subtle bugs to surface over the years. So perhaps we can say that, in the ast, this node contains a single space? |
This macro call fails to expand for me:
https://github.com/near/nearcore/blob/d338e91390c9b3ed422c66dbfd2548bcc8282249/genesis-tools/genesis-csv-to-json/src/csv_parser.rs#L345-L347
I think this is related to
$vis
token producing an empty match, as the following works:pub RES => "res/test_accounts.csv"
The text was updated successfully, but these errors were encountered: