Skip to content

Commit 1404784

Browse files
committed
Fix intra-doc links for associated constants
Previously, only associated functions would be resolved.
1 parent 1dc748f commit 1404784

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,10 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
261261
ns,
262262
impl_,
263263
)
264-
.and_then(|item| match item.kind {
265-
ty::AssocKind::Fn => Some("method"),
266-
_ => None,
264+
.map(|item| match item.kind {
265+
ty::AssocKind::Fn => "method",
266+
ty::AssocKind::Const => "associatedconstant",
267+
ty::AssocKind::Type => "associatedtype",
267268
})
268269
.map(|out| (prim, Some(format!("{}#{}.{}", path, out, item_name))));
269270
if let Some(link) = link {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// ignore-tidy-linelength
2+
#![deny(broken_intra_doc_links)]
3+
4+
//! [i32::MAX]
5+
// @has intra_link_prim_assoc/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' "i32::MAX"

0 commit comments

Comments
 (0)