-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Starting with an ambiguous lib.rs:
pub mod x {}
pub fn x() {}
/// [x]
pub struct S;
rustdoc correctly reports the ambiguity and suggests the possible resolutions:
warning: `x` is both a module and a function
--> src/lib.rs:4:6
|
4 | /// [x]
| ^ ambiguous link
|
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default
help: to link to the module, prefix with the item type
|
4 | /// [module@x]
| ^^^^^^^^
help: to link to the function, add parentheses
|
4 | /// [x()]
| ^^^
In this case I want to link to the module so let's update lib.rs:
pub mod x {}
pub fn x() {}
/// [module@x]
pub struct S;
cargo doc
accepts this without warnings but the generated html file contains:
<a href="../repro/fn.x.html" title="module@x">module@x</a>
I would expect [module@x] to link to the module x, not the function x.
Mentioning tracking issue: #43466
Metadata
Metadata
Assignees
Labels
A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.