-
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 forwarding macro $args:tt #45733
Comments
Hi, could you
Thanks! |
Ah, I had a syntax error in the above code, I had But it should work with this: macro_rules! gen_orm2 {
($name:ident, $table:ident, {$($field:ident: $type:ty,)+}) => (
gen_orm!($name, $table, stringify!($table), {$($field: $type,)+});
)
} But I still get the ICE with this. |
Not reproducible, could please you post a complete example? // Works fine in playground.
macro_rules! gen_orm {
($name:ident, $table:ident, $table_name:expr, {$($field:ident: $type:ty,)+}) => ()
}
macro_rules! gen_orm2 {
($name:ident, $table:ident, {$($field:ident: $type:ty,)+}) => (
gen_orm!($name, $table, stringify!($table), {$($field: $type,)+});
)
}
fn main() {
gen_orm2!(Foo, foos, { meow: i32, percent: i32, });
} |
Ah, thanks. After I updated my nightly it works now :) But then I get another error because inside
How can I |
Unfortunately no, that would require rust-lang/rfcs#1628. |
I wanted to write a macro wrapper around another macro so that I don't have to pass the stringified 2nd arg manually:
But I got the above error:
But it works when I call gen_orm manually:
gen_orm!(Foo, foos, "foos", { meow: i32, percent: i32, });
So then I tried rewriting it into this:
so that it just forwards the args after the 2nd arg.
But lo and behold, rustc decided to ice on me:
What's the correct way to achieve what I want (not having to write the stringified 2nd arg manually by forwarding)?
And why did it complain about
:
in the first place, when there is clearly a rule matching that?I also get the ICE with:
The text was updated successfully, but these errors were encountered: