@@ -259,26 +259,43 @@ fn build_impls(cx: &DocContext, tcx: &ty::ctxt,
259
259
impls. into_iter ( ) . filter_map ( |a| a) . collect ( )
260
260
}
261
261
262
- fn build_impl ( cx : & DocContext , tcx : & ty:: ctxt ,
262
+ fn build_impl ( cx : & DocContext ,
263
+ tcx : & ty:: ctxt ,
263
264
did : ast:: DefId ) -> Option < clean:: Item > {
264
265
if !cx. inlined . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did) {
265
266
return None
266
267
}
267
268
269
+ let attrs = load_attrs ( cx, tcx, did) ;
268
270
let associated_trait = csearch:: get_impl_trait ( tcx, did) ;
269
- // If this is an impl for a #[doc(hidden)] trait, be sure to not inline it.
270
- match associated_trait {
271
- Some ( ref t) => {
272
- let trait_attrs = load_attrs ( cx, tcx, t. def_id ) ;
273
- if trait_attrs. iter ( ) . any ( |a| is_doc_hidden ( a) ) {
274
- return None
275
- }
271
+ if let Some ( ref t) = associated_trait {
272
+ // If this is an impl for a #[doc(hidden)] trait, be sure to not inline
273
+ let trait_attrs = load_attrs ( cx, tcx, t. def_id ) ;
274
+ if trait_attrs. iter ( ) . any ( |a| is_doc_hidden ( a) ) {
275
+ return None
276
276
}
277
- None => { }
278
277
}
279
278
280
- let attrs = load_attrs ( cx, tcx, did) ;
281
- let ty = ty:: lookup_item_type ( tcx, did) ;
279
+ // If this is a defaulted impl, then bail out early here
280
+ if csearch:: is_default_impl ( & tcx. sess . cstore , did) {
281
+ return Some ( clean:: Item {
282
+ inner : clean:: DefaultImplItem ( clean:: DefaultImpl {
283
+ // FIXME: this should be decoded
284
+ unsafety : ast:: Unsafety :: Normal ,
285
+ trait_ : match associated_trait. as_ref ( ) . unwrap ( ) . clean ( cx) {
286
+ clean:: TraitBound ( polyt, _) => polyt. trait_ ,
287
+ clean:: RegionBound ( ..) => unreachable ! ( ) ,
288
+ } ,
289
+ } ) ,
290
+ source : clean:: Span :: empty ( ) ,
291
+ name : None ,
292
+ attrs : attrs,
293
+ visibility : Some ( ast:: Inherited ) ,
294
+ stability : stability:: lookup ( tcx, did) . clean ( cx) ,
295
+ def_id : did,
296
+ } ) ;
297
+ }
298
+
282
299
let predicates = ty:: lookup_predicates ( tcx, did) ;
283
300
let trait_items = csearch:: get_impl_items ( & tcx. sess . cstore , did)
284
301
. iter ( )
@@ -330,8 +347,10 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
330
347
}
331
348
} ) . collect ( ) ;
332
349
let polarity = csearch:: get_impl_polarity ( tcx, did) ;
350
+ let ty = ty:: lookup_item_type ( tcx, did) ;
333
351
return Some ( clean:: Item {
334
352
inner : clean:: ImplItem ( clean:: Impl {
353
+ unsafety : ast:: Unsafety :: Normal , // FIXME: this should be decoded
335
354
derived : clean:: detect_derived ( & attrs) ,
336
355
trait_ : associated_trait. clean ( cx) . map ( |bound| {
337
356
match bound {
0 commit comments