Skip to content

Commit 0847b79

Browse files
committed
Remove ResolverTree
1 parent 2a47113 commit 0847b79

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

compiler/rustc_resolve/src/effective_visibilities.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{NameBinding, NameBindingKind, Resolver, ResolverTree};
1+
use crate::{NameBinding, NameBindingKind, Resolver};
22
use rustc_ast::ast;
33
use rustc_ast::visit;
44
use rustc_ast::visit::Visitor;
@@ -100,11 +100,7 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> {
100100
for (binding, eff_vis) in visitor.import_effective_visibilities.iter() {
101101
let NameBindingKind::Import { import, .. } = binding.kind else { unreachable!() };
102102
if let Some(node_id) = import.id() {
103-
r.effective_visibilities.update_eff_vis(
104-
r.local_def_id(node_id),
105-
eff_vis,
106-
ResolverTree(&r.tcx.untracked()),
107-
)
103+
r.effective_visibilities.update_eff_vis(r.local_def_id(node_id), eff_vis, r.tcx)
108104
}
109105
}
110106

compiler/rustc_resolve/src/lib.rs

+2-19
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use rustc_middle::span_bug;
4444
use rustc_middle::ty::{self, DefIdTree, MainDefinition, RegisteredTools, TyCtxt};
4545
use rustc_middle::ty::{ResolverGlobalCtxt, ResolverOutputs};
4646
use rustc_query_system::ich::StableHashingContext;
47-
use rustc_session::cstore::{CrateStore, Untracked};
47+
use rustc_session::cstore::CrateStore;
4848
use rustc_session::lint::LintBuffer;
4949
use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind, SyntaxContext, Transparency};
5050
use rustc_span::source_map::Spanned;
@@ -1113,27 +1113,10 @@ impl<'a, 'tcx> AsMut<Resolver<'a, 'tcx>> for Resolver<'a, 'tcx> {
11131113
}
11141114
}
11151115

1116-
/// A minimal subset of resolver that can implemenent `DefIdTree`, sometimes
1117-
/// required to satisfy borrow checker by avoiding borrowing the whole resolver.
1118-
#[derive(Clone, Copy)]
1119-
struct ResolverTree<'a>(&'a Untracked);
1120-
1121-
impl DefIdTree for ResolverTree<'_> {
1122-
#[inline]
1123-
fn opt_parent(self, id: DefId) -> Option<DefId> {
1124-
let ResolverTree(Untracked { definitions, cstore, .. }) = self;
1125-
match id.as_local() {
1126-
Some(id) => definitions.read().def_key(id).parent,
1127-
None => cstore.read().as_any().downcast_ref::<CStore>().unwrap().def_key(id).parent,
1128-
}
1129-
.map(|index| DefId { index, ..id })
1130-
}
1131-
}
1132-
11331116
impl<'a, 'b, 'tcx> DefIdTree for &'a Resolver<'b, 'tcx> {
11341117
#[inline]
11351118
fn opt_parent(self, id: DefId) -> Option<DefId> {
1136-
ResolverTree(&self.tcx.untracked()).opt_parent(id)
1119+
self.tcx.opt_parent(id)
11371120
}
11381121
}
11391122

0 commit comments

Comments
 (0)