-
Notifications
You must be signed in to change notification settings - Fork 14k
Lowering cleanups [1/N] #51806
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
Lowering cleanups [1/N] #51806
Conversation
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @cramertj I touched a lot of the async lowering code |
This comment has been minimized.
This comment has been minimized.
src/librustc/hir/map/collector.rs
Outdated
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.
Should this be bug!?
|
☔ The latest upstream changes (presumably #51805) made this pull request unmergeable. Please resolve the merge conflicts. |
1ebe798 to
f68b1e7
Compare
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
src/librustc/hir/lowering.rs
Outdated
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.
Nit: why switch this to match?
src/librustc/hir/lowering.rs
Outdated
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.
Can you leave a comment about what the NodeId is used for? At first glance I expected it to be the closure_node_id that is stored in IsAsync, and was surprised that it was actually for the impl Trait.
src/librustc/hir/lowering.rs
Outdated
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 see this copy-pasted a few places-- can you break this out into a return_impl_trait_id method that returns an Option<NodeId>?
src/librustc/hir/lowering.rs
Outdated
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.
Nit: this async impl trait id addition is copy-pasted below-- I feel like it belongs as part of lower_impl_trait_ids for the function in question. It's unfortunate that async means that the FnDecl on its own isn't enough to see all of the impl Trait instances-- perhaps have lower_impl_trait_ids also accept the FnHeader, or maybe just the IsAsync?
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.
Nice-- I'm glad to see these moved to def_collector.
src/librustc/hir/intravisit.rs
Outdated
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.
Can you leave a comment here explaining that we don't visit the impl Trait ID here because it's collected by lower_item_id for the function itself? (here)
|
This is great! r=me with nits addressed. |
|
☔ The latest upstream changes (presumably #51773) made this pull request unmergeable. Please resolve the merge conflicts. |
1fc4518 to
f21a98d
Compare
|
@bors r=cramertj |
|
📌 Commit f21a98d has been approved by |
|
@bors r=cramertj |
|
📌 Commit 99575b5 has been approved by |
|
⌛ Testing commit 99575b5 with merge 8edb2c121e01c78b5a8d52fb411b108cdf964e24... |
|
💔 Test failed - status-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
1 similar comment
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
| // as part of the surrounding module. The `NodeId` just exists so we don't have to look | ||
| // it up everywhere else in the compiler | ||
| visitor.visit_def_mention(Def::Existential(def_id)); | ||
| visitor.visit_nested_item(item_id); |
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.
Hang on, if the NodeId is pointing to the same thing as the DefId, why do we keep both?!
We only really need the DefId for most of the compilation, AFAIK, and the occasional need to get the NodeId from the DefId shouldn't be enough to keep the NodeId in the HIR.
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 have further refactorings planned, this entire variant is getting removed ASAP, so I didn't feel very motivated to make it idiomatic
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.
Oh, huh, are you going with a fake 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.
Yea, not very fake though. The items are already real and in the parent of the function.
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.
Yeah, I mean just not part of the original AST. Seems good!
|
☀️ Test successful - status-appveyor, status-travis |
Lowering cleanups [3/N] Needs #51806 to be merged first
No description provided.