impl Clean<Type> for hir::Ty {
fn clean(&self, cx: &DocContext) -> Type {
use rustc::hir::*;
+
match self.node {
TyKind::Never => Never,
TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)),
if let Some(bounds) = cx.impl_trait_bounds.borrow_mut().remove(&did) {
return ImplTrait(bounds);
}
+ } else if let Def::Existential(did) = path.def {
+ // This block is for returned impl trait only.
+ if let Some(node_id) = cx.tcx.hir.as_local_node_id(did) {
+ let item = cx.tcx.hir.expect_item(node_id);
+ if let hir::ItemKind::Existential(ref ty) = item.node {
+ return ImplTrait(ty.bounds.clean(cx));
+ }
+ }
}
let mut alias = None;
let mut ty_substs = FxHashMap();
let mut lt_substs = FxHashMap();
provided_params.with_generic_args(|generic_args| {
- let mut indices = ty::GenericParamCount {
- lifetimes: 0,
- types: 0
- };
+ let mut indices: GenericParamCount = Default::default();
for param in generics.params.iter() {
match param.kind {
hir::GenericParamKind::Lifetime { .. } => {