You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a macro_rules! macro with a path fragment $x:path, the macro fails to expand if you pass a path containing a non-turbofish generic (i.e. Foo<T> instead of Foo::<T>) to it. I only checked with the experimental macro expander. I do not know how the classic one behaves.
It seems like the macro expander uses an incorrect grammar for the path fragments. According to the rust reference the :: before generic args should be optional.
Steps to reproduce
Minimal-ish example:
traitFoo<T>{}macro_rules! foo {($p:path) => {structBar<P: $p> {
inner: P,
}};}foo!(u32);// able to expandfoo!(Foo::<u32>);// able to expandfoo!(Foo<u32>);// ERROR: Failed to expand the macro
The text was updated successfully, but these errors were encountered:
Environment
0.2.121.3059-201-stable
1.45.0-nightly
Problem description
When you have a
macro_rules!
macro with a path fragment$x:path
, the macro fails to expand if you pass a path containing a non-turbofish generic (i.e.Foo<T>
instead ofFoo::<T>
) to it. I only checked with the experimental macro expander. I do not know how the classic one behaves.It seems like the macro expander uses an incorrect grammar for the
path
fragments. According to the rust reference the::
before generic args should be optional.Steps to reproduce
Minimal-ish example:
The text was updated successfully, but these errors were encountered: