X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustdoc%2Fhtml%2Frender%2Fcache.rs;h=7336b8b41ac161d4c3232374b9fa194756f767cb;hb=91d3b7201e239c9966d43c0eaf1a4b636b0e06a8;hp=0734d2670ccfae7b07379fc8630d3408937a67f2;hpb=7c1283a0686893ee7d906168c40d905db909d3a3;p=rust.git diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index 0734d2670cc..7336b8b41ac 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -42,7 +42,7 @@ name: item.name.unwrap().to_string(), path: fqp[..fqp.len() - 1].join("::"), desc, - parent: Some(did.into()), + parent: Some(did), parent_idx: None, search_type: get_index_search_type(&item, tcx), aliases: item.attrs.get_doc_aliases(), @@ -226,16 +226,13 @@ fn get_index_type(clean_type: &clean::Type) -> RenderType { fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option { match *clean_type { clean::ResolvedPath { ref path, .. } => { - let segments = &path.segments; - let path_segment = segments.iter().last().unwrap_or_else(|| { - panic!( - "get_index_type_name(clean_type: {:?}, accept_generic: {:?}) had length zero path", - clean_type, accept_generic - ) - }); + let path_segment = path.segments.last().unwrap(); Some(path_segment.name) } - clean::DynTrait(ref bounds, _) => get_index_type_name(&bounds[0].trait_, accept_generic), + clean::DynTrait(ref bounds, _) => { + let path = &bounds[0].trait_; + Some(path.segments.last().unwrap().name) + } clean::Generic(s) if accept_generic => Some(s), clean::Primitive(ref p) => Some(p.as_sym()), clean::BorrowedRef { ref type_, .. } => get_index_type_name(type_, accept_generic), @@ -244,7 +241,6 @@ fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option | clean::Tuple(_) | clean::Slice(_) | clean::Array(_, _) - | clean::Never | clean::RawPointer(_, _) | clean::QPath { .. } | clean::Infer @@ -325,7 +321,8 @@ fn insert(res: &mut FxHashSet<(Type, ItemType)>, tcx: TyCtxt<'_>, ty: Type) -> u } if let Some(bound) = generics.params.iter().find(|g| g.is_type() && g.name == arg_s) { for bound in bound.get_bounds().unwrap_or(&[]) { - if let Some(ty) = bound.get_trait_type() { + if let Some(path) = bound.get_trait_path() { + let ty = Type::ResolvedPath { did: path.res.def_id(), path }; let adds = get_real_types(generics, &ty, tcx, recurse + 1, res); nb_added += adds; if adds == 0 && !ty.is_full_generic() {