]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/passes/collect_intra_doc_links.rs
Rollup merge of #104317 - RalfJung:ctfe-error-reporting, r=oli-obk
[rust.git] / src / librustdoc / passes / collect_intra_doc_links.rs
index 0bd0dbbeb702ca6ef46be3e8a030606c4479da69..37a28b6b7bd84a17282686cdc40dc816d1e70ce6 100644 (file)
@@ -402,6 +402,7 @@ fn resolve_self_ty(&self, path_str: &str, ns: Namespace, item_id: ItemId) -> Opt
             })
             .and_then(|self_id| match tcx.def_kind(self_id) {
                 DefKind::Impl => self.def_id_to_res(self_id),
+                DefKind::Use => None,
                 def_kind => Some(Res::Def(def_kind, self_id)),
             })
     }
@@ -1772,7 +1773,6 @@ fn split(path: &str) -> Option<(&str, &str)> {
 
                     // Otherwise, it must be an associated item or variant
                     let res = partial_res.expect("None case was handled by `last_found_module`");
-                    let name = res.name(tcx);
                     let kind = match res {
                         Res::Def(kind, _) => Some(kind),
                         Res::Primitive(_) => None,
@@ -1814,6 +1814,7 @@ fn split(path: &str) -> Option<(&str, &str)> {
                     } else {
                         "associated item"
                     };
+                    let name = res.name(tcx);
                     let note = format!(
                         "the {} `{}` has no {} named `{}`",
                         res.descr(),