Skip to content

Commit f0b662e

Browse files
committed
Remove all_fake_def_ids
1 parent a9c2094 commit f0b662e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/librustdoc/core.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ crate struct DocContext<'tcx> {
6767
/// Table synthetic type parameter for `impl Trait` in argument position -> bounds
6868
crate impl_trait_bounds: RefCell<FxHashMap<ImplTraitParam, Vec<clean::GenericBound>>>,
6969
crate fake_def_ids: RefCell<FxHashMap<CrateNum, DefId>>,
70-
crate all_fake_def_ids: RefCell<FxHashSet<DefId>>,
7170
/// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`.
7271
// FIXME(eddyb) make this a `ty::TraitRef<'tcx>` set.
7372
crate generated_synthetics: RefCell<FxHashSet<(Ty<'tcx>, DefId)>>,
@@ -163,17 +162,16 @@ impl<'tcx> DocContext<'tcx> {
163162
Entry::Occupied(e) => e.into_mut(),
164163
};
165164
*def_id = DefId { krate: crate_num, index: DefIndex::from(def_id.index.index() + 1) };
166-
let def_id = *def_id;
167165

168-
self.all_fake_def_ids.borrow_mut().insert(def_id);
169-
170-
def_id
166+
*def_id
171167
}
172168

173169
/// Like `hir().local_def_id_to_hir_id()`, but skips calling it on fake DefIds.
174170
/// (This avoids a slice-index-out-of-bounds panic.)
175171
crate fn as_local_hir_id(&self, def_id: DefId) -> Option<HirId> {
176-
if self.all_fake_def_ids.borrow().contains(&def_id) {
172+
if MAX_DEF_ID.with(|m| {
173+
m.borrow().get(&def_id.krate).map(|id| id.index <= def_id.index).unwrap_or(false)
174+
}) {
177175
None
178176
} else {
179177
def_id.as_local().map(|def_id| self.tcx.hir().local_def_id_to_hir_id(def_id))
@@ -522,7 +520,6 @@ crate fn run_global_ctxt(
522520
ct_substs: Default::default(),
523521
impl_trait_bounds: Default::default(),
524522
fake_def_ids: Default::default(),
525-
all_fake_def_ids: Default::default(),
526523
generated_synthetics: Default::default(),
527524
auto_traits: tcx
528525
.all_traits(LOCAL_CRATE)

0 commit comments

Comments
 (0)