1
Fork 0

Separate hir_owner query into two queries to avoid using extensive data on incr comp most of the time

This commit is contained in:
Santiago Pastorino 2022-01-28 14:58:27 -03:00
parent a0bcce4884
commit d17eb78cf8
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
3 changed files with 29 additions and 16 deletions

View file

@ -65,6 +65,11 @@ pub fn provide(providers: &mut Providers) {
providers.crate_hash = map::crate_hash;
providers.hir_module_items = map::hir_module_items;
providers.hir_owner = |tcx, id| {
let owner = tcx.hir_crate(()).owners.get(id)?.as_owner()?;
let node = owner.node();
Some(Owner { node, hash_without_bodies: owner.nodes.hash_without_bodies })
};
providers.local_def_id_to_hir_id = |tcx, id| {
tcx.hir_crate(()).owners[id].map(|owner| {
let node = owner.nodes.node();
Owner { node, hash_without_bodies: owner.nodes.hash_without_bodies }