Uh oh!
There was an error while loading. Please reload this page.
rustc: Remove HirId from queries - #44435
Conversation
rust-highfive
commented
Sep 8, 2017
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Sep 8, 2017
There was a problem hiding this comment.
I believe there's DefIdMap and DefIdSet aliases which could be used for these changes.
There was a problem hiding this comment.
So with_freevars used to be a thing because of a RefCell. Can it be removed in favor of tcx.freevars(def_id)? All callers should, ironically, already have a closure DefId around.
kennytm
commented
Sep 9, 2017
Could not compile |
bors
commented
Sep 9, 2017
☔ The latest upstream changes (presumably #44335) made this pull request unmergeable. Please resolve the merge conflicts. |
michaelwoerister
commented
Sep 9, 2017
Thanks, @alexcrichton! Unfortunately it won't be as easy as just replacing implTyCtxt{fnin_scope_traits_of_expr(self,hir_id:HirId) -> Option<Rc<Vec<TraitCandidate>>>{// Get the map for the item containing the HirId. This is a query:let map_for_containing_item = self.in_scope_traits_of_item(hir_id.owner);// From that item-local map get actual return value
map_for_containing_item.get(hir_id.local_id).cloned()}} |
alexcrichton
commented
Sep 9, 2017
Heh yeah the panics figured that out pretty quickly here! I'll work on making these sub-maps. |
14c68ee to
7e49951Comparealexcrichton
commented
Sep 9, 2017
Alright I believe the necessary maps have been transitioned, re-r? @michaelwoerister |
There was a problem hiding this comment.
Why not use DefId here? Closures have DefIds.
There was a problem hiding this comment.
Indeed! Got a bit overzealous with DefIndex
michaelwoerister
left a comment
There was a problem hiding this comment.
Looks good to me except for that one performance concern.
There was a problem hiding this comment.
Whoops, I should better have listened to @arielb1 and marked find_node_for_hir_id as super-slow somehow. It does a linear search over all NodeIds 😰
But it seems that what you're doing here is equivalent to tcx.hir.as_local_node_id(id).unwrap()?
There was a problem hiding this comment.
Why does find_node_for_hir_id exist? I've introduced hir_to_node_id. (EDIT: I generated a reverse HashMap for that purpose)
There was a problem hiding this comment.
Oh, I see. It does exist because I wanted to avoid building that reverse mapping because it was only needed in error reporting. It's probably cheap to build though, especially now that locals don't have DefIds anymore.
alexcrichton
commented
Sep 11, 2017
@bors: r=michaelwoerister |
bors
commented
Sep 11, 2017
📌 Commit 772ca85 has been approved by |
This'll allow us to reconstruct query parameters purely from the `DepNode` they're associated with. Some queries could move straight to `HirId` but others that don't always have a correspondance between `HirId` and `DefId` moved to two-level maps where the query operates over a `DefIndex`, returning a map, which is then keyed off `ItemLocalId`. Closesrust-lang#44414
alexcrichton
commented
Sep 11, 2017
@bors: r=michaelwoerister |
bors
commented
Sep 11, 2017
📌 Commit caaf365 has been approved by |
bors
commented
Sep 11, 2017
rustc: Remove HirId from queries This'll allow us to reconstruct query parameters purely from the `DepNode` they're associated with. Closes#44414
bors
commented
Sep 11, 2017
☀️ Test successful - status-appveyor, status-travis |
This'll allow us to reconstruct query parameters purely from the
DepNodethey're associated with.
Closes#44414