X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustdoc%2Fvisit_ast.rs;h=22068ebe041c729ca87e33470255f9e40c22bb3b;hb=793df7f5f0b517961bf638bbc29c0ec172b4c1f3;hp=c788b9f4093fea7721b838118443e16a71708ee1;hpb=b6097f2e1b2ca62e188ba53cf43bd66b06b36915;p=rust.git diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index c788b9f4093..22068ebe041 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -301,39 +301,40 @@ fn visit_item( hir::ItemKind::GlobalAsm(..) => {} hir::ItemKind::Use(_, hir::UseKind::ListStem) => {} hir::ItemKind::Use(path, kind) => { - let is_glob = kind == hir::UseKind::Glob; - - // Struct and variant constructors and proc macro stubs always show up alongside - // their definitions, we've already processed them so just discard these. - if let Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) = path.res { - return; - } - - let attrs = self.cx.tcx.hir().attrs(item.hir_id()); + for &res in &path.res { + // Struct and variant constructors and proc macro stubs always show up alongside + // their definitions, we've already processed them so just discard these. + if let Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) = res { + continue; + } - // If there was a private module in the current path then don't bother inlining - // anything as it will probably be stripped anyway. - if is_pub && self.inside_public_path { - let please_inline = attrs.iter().any(|item| match item.meta_item_list() { - Some(ref list) if item.has_name(sym::doc) => { - list.iter().any(|i| i.has_name(sym::inline)) + let attrs = self.cx.tcx.hir().attrs(item.hir_id()); + + // If there was a private module in the current path then don't bother inlining + // anything as it will probably be stripped anyway. + if is_pub && self.inside_public_path { + let please_inline = attrs.iter().any(|item| match item.meta_item_list() { + Some(ref list) if item.has_name(sym::doc) => { + list.iter().any(|i| i.has_name(sym::inline)) + } + _ => false, + }); + let is_glob = kind == hir::UseKind::Glob; + let ident = if is_glob { None } else { Some(name) }; + if self.maybe_inline_local( + item.hir_id(), + res, + ident, + is_glob, + om, + please_inline, + ) { + continue; } - _ => false, - }); - let ident = if is_glob { None } else { Some(name) }; - if self.maybe_inline_local( - item.hir_id(), - path.res, - ident, - is_glob, - om, - please_inline, - ) { - return; } - } - om.items.push((item, renamed, parent_id)) + om.items.push((item, renamed, parent_id)) + } } hir::ItemKind::Macro(ref macro_def, _) => { // `#[macro_export] macro_rules!` items are handled separately in `visit()`,