@@ -207,7 +207,7 @@ fn build_impls(cx: &core::DocContext,
207
207
match tcx. inherent_impls . borrow ( ) . find ( & did) {
208
208
None => { }
209
209
Some ( i) => {
210
- impls. extend ( i. borrow ( ) . iter ( ) . map ( |& did| { build_impl ( tcx, did) } ) ) ;
210
+ impls. extend ( i. borrow ( ) . iter ( ) . map ( |& did| { build_impl ( cx , tcx, did) } ) ) ;
211
211
}
212
212
}
213
213
@@ -223,30 +223,37 @@ fn build_impls(cx: &core::DocContext,
223
223
csearch:: each_top_level_item_of_crate ( & tcx. sess . cstore ,
224
224
did. krate ,
225
225
|def, _, _| {
226
- populate_impls ( tcx, def, & mut impls)
226
+ populate_impls ( cx , tcx, def, & mut impls)
227
227
} ) ;
228
228
229
- fn populate_impls ( tcx : & ty:: ctxt ,
229
+ fn populate_impls ( cx : & core:: DocContext ,
230
+ tcx : & ty:: ctxt ,
230
231
def : decoder:: DefLike ,
231
- impls : & mut Vec < clean:: Item > ) {
232
+ impls : & mut Vec < Option < clean:: Item > > ) {
232
233
match def {
233
- decoder:: DlImpl ( did) => impls. push ( build_impl ( tcx, did) ) ,
234
+ decoder:: DlImpl ( did) => impls. push ( build_impl ( cx , tcx, did) ) ,
234
235
decoder:: DlDef ( ast:: DefMod ( did) ) => {
235
236
csearch:: each_child_of_item ( & tcx. sess . cstore ,
236
237
did,
237
238
|def, _, _| {
238
- populate_impls ( tcx, def, impls)
239
+ populate_impls ( cx , tcx, def, impls)
239
240
} )
240
241
}
241
242
_ => { }
242
243
}
243
244
}
244
245
}
245
246
246
- impls
247
+ impls. move_iter ( ) . filter_map ( |a| a ) . collect ( )
247
248
}
248
249
249
- fn build_impl ( tcx : & ty:: ctxt , did : ast:: DefId ) -> clean:: Item {
250
+ fn build_impl ( cx : & core:: DocContext ,
251
+ tcx : & ty:: ctxt ,
252
+ did : ast:: DefId ) -> Option < clean:: Item > {
253
+ if !cx. inlined . borrow_mut ( ) . get_mut_ref ( ) . insert ( did) {
254
+ return None
255
+ }
256
+
250
257
let associated_trait = csearch:: get_impl_trait ( tcx, did) ;
251
258
let attrs = load_attrs ( tcx, did) ;
252
259
let ty = ty:: lookup_item_type ( tcx, did) ;
@@ -275,7 +282,7 @@ fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> clean::Item {
275
282
} ;
276
283
Some ( item)
277
284
} ) . collect ( ) ;
278
- clean:: Item {
285
+ Some ( clean:: Item {
279
286
inner : clean:: ImplItem ( clean:: Impl {
280
287
derived : clean:: detect_derived ( attrs. as_slice ( ) ) ,
281
288
trait_ : associated_trait. clean ( ) . map ( |bound| {
@@ -293,7 +300,7 @@ fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> clean::Item {
293
300
attrs : attrs,
294
301
visibility : Some ( ast:: Inherited ) ,
295
302
def_id : did,
296
- }
303
+ } )
297
304
}
298
305
299
306
fn build_module ( cx : & core:: DocContext , tcx : & ty:: ctxt ,
0 commit comments