diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 65d116b9c670c..412ab30a603b7 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -261,9 +261,10 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { ns, impl_, ) - .and_then(|item| match item.kind { - ty::AssocKind::Fn => Some("method"), - _ => None, + .map(|item| match item.kind { + ty::AssocKind::Fn => "method", + ty::AssocKind::Const => "associatedconstant", + ty::AssocKind::Type => "associatedtype", }) .map(|out| (prim, Some(format!("{}#{}.{}", path, out, item_name)))); if let Some(link) = link { diff --git a/src/test/rustdoc/intra-link-prim-assoc.rs b/src/test/rustdoc/intra-link-prim-assoc.rs new file mode 100644 index 0000000000000..c0066885e1991 --- /dev/null +++ b/src/test/rustdoc/intra-link-prim-assoc.rs @@ -0,0 +1,5 @@ +// ignore-tidy-linelength +#![deny(broken_intra_doc_links)] + +//! [i32::MAX] +// @has intra_link_prim_assoc/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' "i32::MAX"