Fix intra-doc links for associated constants
Previously, only associated functions would be resolved.
This commit is contained in:
parent
1dc748fb3d
commit
1404784992
2 changed files with 9 additions and 3 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
5
src/test/rustdoc/intra-link-prim-assoc.rs
Normal file
5
src/test/rustdoc/intra-link-prim-assoc.rs
Normal file
|
|
@ -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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue