Lower only one HIR owner at a time by cjgillot · Pull Request #87234 · rust-lang/rust (original) (raw)
@cjgillot
Could you explain what's going on with the "HirId preallocation" changes in more details?
Why were the HirIds pre-allocated? Why don't they need to be pre-allocated now? When they are allocated if they are not pre-allocated? (What does it even mean to allocate a HirId?)
By "HirId preallocation", for lack of a better word, I mean calls to allocate_hir_id_counter
.
This pre-allocation basically declared to the lowering context that such NodeId was a HIR owner, and had to be lowered as such.
For item-likes, this was not necessary: we know that the nodes are only lowered when lowering the item itself, or when lowering a reference to the item. Calling allocate_hir_id_counter
at that moment is enough.
For use
items, the situation is essentially the same, with the additional subtlety that each use is associated with several definitions, and only part of those definitions actually get referenced in the HIR.
Why is
item_local_id_counters
keyed onNodeId
s and notLocalDefId
s despite theNodeId
s having the owner semantics?
I had changed that before messing up the rebase.