@@ -67,7 +67,6 @@ crate struct DocContext<'tcx> {
67
67
/// Table synthetic type parameter for `impl Trait` in argument position -> bounds
68
68
crate impl_trait_bounds : RefCell < FxHashMap < ImplTraitParam , Vec < clean:: GenericBound > > > ,
69
69
crate fake_def_ids : RefCell < FxHashMap < CrateNum , DefId > > ,
70
- crate all_fake_def_ids : RefCell < FxHashSet < DefId > > ,
71
70
/// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`.
72
71
// FIXME(eddyb) make this a `ty::TraitRef<'tcx>` set.
73
72
crate generated_synthetics : RefCell < FxHashSet < ( Ty < ' tcx > , DefId ) > > ,
@@ -163,17 +162,16 @@ impl<'tcx> DocContext<'tcx> {
163
162
Entry :: Occupied ( e) => e. into_mut ( ) ,
164
163
} ;
165
164
* def_id = DefId { krate : crate_num, index : DefIndex :: from ( def_id. index . index ( ) + 1 ) } ;
166
- let def_id = * def_id;
167
165
168
- self . all_fake_def_ids . borrow_mut ( ) . insert ( def_id) ;
169
-
170
- def_id
166
+ * def_id
171
167
}
172
168
173
169
/// Like `hir().local_def_id_to_hir_id()`, but skips calling it on fake DefIds.
174
170
/// (This avoids a slice-index-out-of-bounds panic.)
175
171
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
+ } ) {
177
175
None
178
176
} else {
179
177
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(
522
520
ct_substs : Default :: default ( ) ,
523
521
impl_trait_bounds : Default :: default ( ) ,
524
522
fake_def_ids : Default :: default ( ) ,
525
- all_fake_def_ids : Default :: default ( ) ,
526
523
generated_synthetics : Default :: default ( ) ,
527
524
auto_traits : tcx
528
525
. all_traits ( LOCAL_CRATE )
0 commit comments