@@ -259,26 +259,43 @@ fn build_impls(cx: &DocContext, tcx: &ty::ctxt,
259259 impls. into_iter ( ) . filter_map ( |a| a) . collect ( )
260260}
261261
262- fn build_impl ( cx : & DocContext , tcx : & ty:: ctxt ,
262+ fn build_impl ( cx : & DocContext ,
263+ tcx : & ty:: ctxt ,
263264 did : ast:: DefId ) -> Option < clean:: Item > {
264265 if !cx. inlined . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did) {
265266 return None
266267 }
267268
269+ let attrs = load_attrs ( cx, tcx, did) ;
268270 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
276276 }
277- None => { }
278277 }
279278
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+
282299 let predicates = ty:: lookup_predicates ( tcx, did) ;
283300 let trait_items = csearch:: get_impl_items ( & tcx. sess . cstore , did)
284301 . iter ( )
@@ -330,8 +347,10 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
330347 }
331348 } ) . collect ( ) ;
332349 let polarity = csearch:: get_impl_polarity ( tcx, did) ;
350+ let ty = ty:: lookup_item_type ( tcx, did) ;
333351 return Some ( clean:: Item {
334352 inner : clean:: ImplItem ( clean:: Impl {
353+ unsafety : ast:: Unsafety :: Normal , // FIXME: this should be decoded
335354 derived : clean:: detect_derived ( & attrs) ,
336355 trait_ : associated_trait. clean ( cx) . map ( |bound| {
337356 match bound {
0 commit comments