-
Notifications
You must be signed in to change notification settings - Fork 13.3k
syntax: Simplify parsing of paths #43438
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
Conversation
//~^ ERROR generic arguments in macro path | ||
//~| ERROR generic arguments in macro path | ||
//~| ERROR generic arguments in macro path | ||
//~| ERROR generic arguments in macro path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why resolve_macro_to_def
is called so many times on macro paths, but it seems to be an orthogonal issue (and maybe a performance concern).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see, it may be undetermined a few times and then resolved later. So the generic check need to be done only when resolution is successful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to do this check in fn finalize_current_module_macro_resolutions
in librustc_resolve/macros.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the necessary information is already lost in finalize_current_module_macro_resolutions
, so I kept it in resolve_macro_to_def
.
Did a first pass-through review, LGTM modulo comment. I'd like to do a second pass over the parser changes tomorrow, otherwise r=me. |
The idea is that |
☔ The latest upstream changes (presumably #43487) made this pull request unmergeable. Please resolve the merge conflicts. |
Looks great! r=me |
@bors r=jseyfried |
📌 Commit 1e8a7f6 has been approved by |
syntax: Simplify parsing of paths Discern between `Path` and `Path<>` in AST (but not in HIR). Give span to angle bracketed generic arguments (`::<'a, T>` in `path::segment::<'a, T>`). This is a refactoring in preparation for https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561/3, but it doesn't add anything to the grammar yet. r? @jseyfried
☀️ Test successful - status-appveyor, status-travis |
Discern between
Path
andPath<>
in AST (but not in HIR).Give span to angle bracketed generic arguments (
::<'a, T>
inpath::segment::<'a, T>
).This is a refactoring in preparation for https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561/3, but it doesn't add anything to the grammar yet.
r? @jseyfried