From 45673e2d443a7bc02469281c138b833c4d12528e Mon Sep 17 00:00:00 2001 From: Camelid Date: Sun, 21 Feb 2021 17:52:23 -0800 Subject: [PATCH] rustdoc: Remove `fake_def_ids` RefCell --- src/librustdoc/core.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 1c2d2ad626c5a..1d249f1b91398 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -67,7 +67,7 @@ crate struct DocContext<'tcx> { crate ct_substs: RefCell>, /// Table synthetic type parameter for `impl Trait` in argument position -> bounds crate impl_trait_bounds: RefCell>>, - crate fake_def_ids: RefCell>, + crate fake_def_ids: FxHashMap, /// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`. // FIXME(eddyb) make this a `ty::TraitRef<'tcx>` set. crate generated_synthetics: RefCell, DefId)>>, @@ -140,16 +140,14 @@ impl<'tcx> DocContext<'tcx> { /// [`RefCell`]: std::cell::RefCell /// [`Debug`]: std::fmt::Debug /// [`clean::Item`]: crate::clean::types::Item - crate fn next_def_id(&self, crate_num: CrateNum) -> DefId { - let mut fake_ids = self.fake_def_ids.borrow_mut(); - - let def_index = match fake_ids.entry(crate_num) { + crate fn next_def_id(&mut self, crate_num: CrateNum) -> DefId { + let def_index = match self.fake_def_ids.entry(crate_num) { Entry::Vacant(e) => { let num_def_idx = { let num_def_idx = if crate_num == LOCAL_CRATE { self.tcx.hir().definitions().def_path_table().num_def_ids() } else { - self.enter_resolver(|r| r.cstore().num_def_ids(crate_num)) + self.resolver.borrow_mut().access(|r| r.cstore().num_def_ids(crate_num)) }; DefIndex::from_usize(num_def_idx)