about summary refs log tree commit diff
path: root/src/librustdoc/clean/mod.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2022-11-25 17:39:38 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2022-12-01 18:51:05 +0300
commit1f259ae6799e7e0a08e5b84fc5686e404b17eef0 (patch)
tree388417f61bf1eb19e633f3e613353f01c05b8730 /src/librustdoc/clean/mod.rs
parent6cd4dd3091dfe0ce4a728bd9ae177361fba23736 (diff)
downloadrust-1f259ae6799e7e0a08e5b84fc5686e404b17eef0.tar.gz
rust-1f259ae6799e7e0a08e5b84fc5686e404b17eef0.zip
rustc_hir: Change representation of import paths to support multiple resolutions
Diffstat (limited to 'src/librustdoc/clean/mod.rs')
-rw-r--r--src/librustdoc/clean/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index b18788a033f..80909919ba2 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2233,6 +2233,26 @@ fn clean_extern_crate<'tcx>(
 fn clean_use_statement<'tcx>(
     import: &hir::Item<'tcx>,
     name: Symbol,
+    path: &hir::UsePath<'tcx>,
+    kind: hir::UseKind,
+    cx: &mut DocContext<'tcx>,
+    inlined_names: &mut FxHashSet<(ItemType, Symbol)>,
+) -> Vec<Item> {
+    let mut items = Vec::new();
+    let hir::UsePath { segments, ref res, span } = *path;
+    for &res in res {
+        if let Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) = res {
+            continue;
+        }
+        let path = hir::Path { segments, res, span };
+        items.append(&mut clean_use_statement_inner(import, name, &path, kind, cx, inlined_names));
+    }
+    items
+}
+
+fn clean_use_statement_inner<'tcx>(
+    import: &hir::Item<'tcx>,
+    name: Symbol,
     path: &hir::Path<'tcx>,
     kind: hir::UseKind,
     cx: &mut DocContext<'tcx>,