-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Macro invocations allow type parameters in the path #28558
Comments
I'd say fix it and do a crater run. |
Sounds like a plan to me |
Ping? |
@drbo I don't think anyone worked on it. |
I fixed this in #34495. |
…ons, r=eddyb Forbid type parameters and global paths in macro invocations Fixes rust-lang#28558. This is a [breaking-change]. For example, the following would break: ```rust macro_rules! m { () => { () } } fn main() { m::<T>!(); // Type parameters are no longer allowed in macro invocations ::m!(); // Global paths are no longer allowed in macro invocations } ``` Any breakage can be fixed by removing the type parameters or the leading `::` (respectively). r? @eddyb
vec::<T,U,V,W::X::Y<Z>>![1,2,3,4];
is valid syntax and compiles to a regular vector.This is because macros use
Path
s, notIdent
s as their names. Multi-segment paths are disallowed, but the path can have type parameters.We can move macros to
Ident
s, however this would not be backwards compatible since anyone usingvec::<T>![1,2]
would get a syntax error (even though the original syntax is meaningless). It's still a bug, so perhaps we can get away with this breaking change.Thoughts?
cc @eddyb @alexcrichton
The text was updated successfully, but these errors were encountered: