ResolverTree does not require access to the crate loader, only the store
This commit is contained in:
parent
14ca83a04b
commit
4b08fbaea8
@ -107,7 +107,7 @@ pub fn compute_effective_visibilities<'c>(r: &'r mut Resolver<'a>, krate: &'c Cr
|
||||
r.effective_visibilities.update_eff_vis(
|
||||
r.local_def_id(node_id),
|
||||
eff_vis,
|
||||
ResolverTree(&r.definitions, &r.crate_loader),
|
||||
ResolverTree(&r.definitions, r.crate_loader.cstore()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1112,15 +1112,15 @@ fn as_mut(&mut self) -> &mut Resolver<'a> {
|
||||
/// A minimal subset of resolver that can implemenent `DefIdTree`, sometimes
|
||||
/// required to satisfy borrow checker by avoiding borrowing the whole resolver.
|
||||
#[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]
|
||||
fn opt_parent(self, id: DefId) -> Option<DefId> {
|
||||
let ResolverTree(definitions, crate_loader) = self;
|
||||
let ResolverTree(definitions, cstore) = self;
|
||||
match id.as_local() {
|
||||
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 })
|
||||
}
|
||||
@ -1129,7 +1129,7 @@ fn opt_parent(self, id: DefId) -> Option<DefId> {
|
||||
impl<'a, 'b> DefIdTree for &'a Resolver<'b> {
|
||||
#[inline]
|
||||
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…
Reference in New Issue
Block a user