mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #76093 - jyn514:prim-assoc-items, r=Manishearth
Fix intra-doc links for associated constants Previously, only associated functions would be resolved. Fixes the issues in https://github.com/rust-lang/rust/pull/75969#discussion_r477898003. I'm a little uncomfortable hard-coding the string constants, but it looks like that's how it's done elsewhere. I might make a follow-up PR at some point putting it in one place. Not sure how to test associated types, since AFAIK there aren't any on primitives. r? @Manishearth
This commit is contained in:
@@ -261,9 +261,10 @@ fn resolve(
|
||||
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 {
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user