-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Macro invocations allow type parameters in the path #28558
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-grammar
Area: The grammar of Rust
A-parser
Area: The lexing & parsing of Rust source code to an AST
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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. |
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Jun 29, 2016
…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
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-grammar
Area: The grammar of Rust
A-parser
Area: The lexing & parsing of Rust source code to an AST
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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: