From 4b08fbaea84a1ecce23af151c9072a02cb9bcdae Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 7 Dec 2022 13:34:05 +0000 Subject: ResolverTree does not require access to the crate loader, only the store --- compiler/rustc_resolve/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler/rustc_resolve/src/lib.rs') 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> 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 { - 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 { - ResolverTree(&self.definitions, &self.crate_loader).opt_parent(id) + ResolverTree(&self.definitions, self.cstore()).opt_parent(id) } } -- cgit 1.4.1-3-g733a5