diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-12-07 13:34:05 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-12-09 14:50:09 +0000 |
| commit | 4b08fbaea84a1ecce23af151c9072a02cb9bcdae (patch) | |
| tree | 4617035e3864da10c5a2d29f96480512b35b01f6 /compiler/rustc_resolve/src | |
| parent | 14ca83a04b00433a8caf3b805d5ea08cb2691e1b (diff) | |
| download | rust-4b08fbaea84a1ecce23af151c9072a02cb9bcdae.tar.gz rust-4b08fbaea84a1ecce23af151c9072a02cb9bcdae.zip | |
ResolverTree does not require access to the crate loader, only the store
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/effective_visibilities.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/effective_visibilities.rs b/compiler/rustc_resolve/src/effective_visibilities.rs index 85399385d1f..3a7d463a625 100644 --- a/compiler/rustc_resolve/src/effective_visibilities.rs +++ b/compiler/rustc_resolve/src/effective_visibilities.rs @@ -107,7 +107,7 @@ impl<'r, 'a> EffectiveVisibilitiesVisitor<'r, 'a> { 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()), ) } } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 82f5d0f534a..816dc4cb4dc 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1112,15 +1112,15 @@ impl<'a> AsMut<Resolver<'a>> for 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 @@ impl DefIdTree for ResolverTree<'_, '_> { 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) } } |
