diff --git a/clean/inline.rs b/clean/inline.rs index e8367bc..185f897 100644 --- a/clean/inline.rs +++ b/clean/inline.rs @@ -364,7 +364,7 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext, let trait_items = tcx.associated_items(did).filter_map(|item| { match item.kind { ty::AssociatedKind::Const => { - let default = if item.has_value { + let default = if item.defaultness.has_value() { Some(pprust::expr_to_string( lookup_const_by_id(tcx, item.def_id, None).unwrap().0)) } else { @@ -407,7 +407,7 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext, abi: abi }) } - _ => panic!("not a tymethod"), + ref r => panic!("not a tymethod: {:?}", r), }; Some(cleaned) } diff --git a/clean/mod.rs b/clean/mod.rs index 4d70c64..a141d0e 100644 --- a/clean/mod.rs +++ b/clean/mod.rs @@ -1373,9 +1373,10 @@ impl<'tcx> Clean for ty::AssociatedItem { } } } + let provided = match self.container { ty::ImplContainer(_) => false, - ty::TraitContainer(_) => self.has_value + ty::TraitContainer(_) => self.defaultness.has_value() }; if provided { MethodItem(Method { @@ -1440,7 +1441,7 @@ impl<'tcx> Clean for ty::AssociatedItem { None => bounds.push(TyParamBound::maybe_sized(cx)), } - let ty = if self.has_value { + let ty = if self.defaultness.has_value() { Some(cx.tcx().item_type(self.def_id)) } else { None diff --git a/visit_ast.rs b/visit_ast.rs index d9155e1..939fd6c 100644 --- a/visit_ast.rs +++ b/visit_ast.rs @@ -502,17 +502,20 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { om.traits.push(t); }, - hir::ItemImpl(unsafety, polarity, ref gen, ref tr, ref ty, ref items) => { + hir::ItemImpl(unsafety, polarity, ref gen, ref tr, ref ty, ref item_ids) => { // Don't duplicate impls when inlining, we'll pick them up // regardless of where they're located. if !self.inlining { + let items = item_ids.iter() + .map(|ii| self.cx.map.impl_item(ii.id).clone()) + .collect(); let i = Impl { unsafety: unsafety, polarity: polarity, generics: gen.clone(), trait_: tr.clone(), for_: ty.clone(), - items: items.clone(), + items: items, attrs: item.attrs.clone(), id: item.id, whence: item.span,