-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Almost fully deprecate hir::map::Map.hir_to_node_id #62975
Conversation
This comment has been minimized.
This comment has been minimized.
0baccc7
to
b9f2e81
Compare
Ping from triage. @Zoxc any updates on this? |
b9f2e81
to
f470005
Compare
@Zoxc done 👍 |
☔ The latest upstream changes (presumably #62955) made this pull request unmergeable. Please resolve the merge conflicts. |
src/librustc/hir/map/definitions.rs
Outdated
pub hir_to_def_index: HirIdMap<DefIndex>, | ||
/// `DefIndex`es created by DefCollector::create_def; used only to complete the hir_to_def_index | ||
/// mapping after the lowering | ||
defs_awaiting_hir_id: NodeMap<DefIndex>, |
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.
This is another reason why I would prefer if everything with a DefId
was a HirId
root: you wouldn't need any mappings, a HIR node with a DefId
would have a HirId
of (def_id, 0)
.
cc @michaelwoerister @nikomatsakis @petrochenkov
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.
IIRC, we wanted HirId
owners to correspond to item-likes mainly because that's the incremental compilation granularity we were shooting for.
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, but that seems like it's introducing artificial complexity (with perhaps the exception of TypeckTables
- but even in that case, we could just have separate TypeckTables
for closures, that are kept in a map in the parent body's TypeckTables
).
Bonus: right now things like embedded constants have their own TypeckTables
but share a HirId
space with their enclosing item, meaning their intra-item IDs are not in a nice 0..n
range (if they were, we could maybe use something more efficient than hashmaps).
The first two commits look good to me, feel free to split those out to a separate PR. I'm less sure about the last one though. I'm probably not the best person to review that. |
08f5d85
to
1954174
Compare
@Zoxc seems that someone already pushed one of those two, so I left the other one and I'll post the last commit as a separate PR. |
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 |
1954174
to
61daee5
Compare
61daee5
to
9a6ca41
Compare
r? @Zoxc |
Pinging again from triage Thank you! |
Ping from triage: could someone review this? @rust-lang/compiler |
I will review it. |
@bors r+ |
📌 Commit 9a6ca41 has been approved by |
⌛ Testing commit 9a6ca41 with merge 3feba9538bbd452d2fcbd57a5dd5c9465a4010e2... |
Almost fully deprecate hir::map::Map.hir_to_node_id - HirIdify `doctree::Module.id` - HirIdify `hir::Crate.modules` - introduce a `HirId` to `DefIndex` map in `map::Definitions` The only last uses of `hir::map::Map.hir_to_node_id` in the compiler are: - for the purposes of `driver::pretty` (in `map::nodes_matching_suffix`), but I don't know if we can remove `NodeId`s in there (I think when I attempted it previously there was some issue due to `HirId` not being representable with an integer) - in `ty::query::on_disk_cache` (not sure about the purpose of this one) - in `mir::transform::check_unsafety` (only important for error message order) Any suggestions how to kill these off? r? @Zoxc
@bors retry rolled up. |
Rollup of 6 pull requests Successful merges: - #62975 (Almost fully deprecate hir::map::Map.hir_to_node_id) - #64386 (use `sign` variable in abs and wrapping_abs methods) - #64508 (or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR) - #64738 (Add const-eval support for SIMD types, insert, and extract) - #64759 (Refactor mbe a tiny bit) - #64764 (Master is now 1.40 ) Failed merges: r? @ghost
doctree::Module.id
hir::Crate.modules
HirId
toDefIndex
map inmap::Definitions
The only last uses of
hir::map::Map.hir_to_node_id
in the compiler are:driver::pretty
(inmap::nodes_matching_suffix
), but I don't know if we can removeNodeId
s in there (I think when I attempted it previously there was some issue due toHirId
not being representable with an integer)ty::query::on_disk_cache
(not sure about the purpose of this one)mir::transform::check_unsafety
(only important for error message order)Any suggestions how to kill these off?
r? @Zoxc