ResolverTree does not require access to the crate loader, only the store
This commit is contained in:
parent
14ca83a04b
commit
4b08fbaea8
2 changed files with 6 additions and 6 deletions
|
@ -107,7 +107,7 @@ impl<'r, 'a> EffectiveVisibilitiesVisitor<'r, 'a> {
|
||||||
r.effective_visibilities.update_eff_vis(
|
r.effective_visibilities.update_eff_vis(
|
||||||
r.local_def_id(node_id),
|
r.local_def_id(node_id),
|
||||||
eff_vis,
|
eff_vis,
|
||||||
ResolverTree(&r.definitions, &r.crate_loader),
|
ResolverTree(&r.definitions, r.crate_loader.cstore()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1112,15 +1112,15 @@ impl<'a> AsMut<Resolver<'a>> for Resolver<'a> {
|
||||||
/// A minimal subset of resolver that can implemenent `DefIdTree`, sometimes
|
/// A minimal subset of resolver that can implemenent `DefIdTree`, sometimes
|
||||||
/// required to satisfy borrow checker by avoiding borrowing the whole resolver.
|
/// required to satisfy borrow checker by avoiding borrowing the whole resolver.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
struct ResolverTree<'a, 'b>(&'a Definitions, &'a CrateLoader<'b>);
|
struct ResolverTree<'a>(&'a Definitions, &'a CStore);
|
||||||
|
|
||||||
impl DefIdTree for ResolverTree<'_, '_> {
|
impl DefIdTree for ResolverTree<'_> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn opt_parent(self, id: DefId) -> Option<DefId> {
|
fn opt_parent(self, id: DefId) -> Option<DefId> {
|
||||||
let ResolverTree(definitions, crate_loader) = self;
|
let ResolverTree(definitions, cstore) = self;
|
||||||
match id.as_local() {
|
match id.as_local() {
|
||||||
Some(id) => definitions.def_key(id).parent,
|
Some(id) => definitions.def_key(id).parent,
|
||||||
None => crate_loader.cstore().def_key(id).parent,
|
None => cstore.def_key(id).parent,
|
||||||
}
|
}
|
||||||
.map(|index| DefId { index, ..id })
|
.map(|index| DefId { index, ..id })
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1129,7 @@ impl DefIdTree for ResolverTree<'_, '_> {
|
||||||
impl<'a, 'b> DefIdTree for &'a Resolver<'b> {
|
impl<'a, 'b> DefIdTree for &'a Resolver<'b> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn opt_parent(self, id: DefId) -> Option<DefId> {
|
fn opt_parent(self, id: DefId) -> Option<DefId> {
|
||||||
ResolverTree(&self.definitions, &self.crate_loader).opt_parent(id)
|
ResolverTree(&self.definitions, self.cstore()).opt_parent(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue