-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
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
pub struct Thing {}
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn Thing() {}
/// Do stuff with [`Thing`].
pub fn repro(_: Thing) {}
$ cargo doc
warning: `Thing` is both a function and a struct
--> src/lib.rs:7:21
|
7 | /// Do stuff with [`Thing`].
| ^^^^^ ambiguous link
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
help: to link to the function, add parentheses
|
7 | /// Do stuff with [`Thing()`].
| ++
help: to link to the struct, prefix with `struct@`
|
7 | /// Do stuff with [`struct@Thing`].
| +++++++
I expected to see this happen: No broken_intra_doc_links warning. [`Thing`]
works and means the same thing as [`struct@Thing`]
, because [`Thing()`]
has been ruled out for being hidden. Explicitly writing [`Thing()`]
produces a broken link. Only when documented with --document-hidden-items
is there an ambiguity.
Instead, this happened: [`Thing`]
and [`Thing()`]
each produce broken link.
Meta
rustc --version --verbose
:
rustc 1.83.0-nightly (0ee7cb5e3 2024-09-10)
binary: rustc
commit-hash: 0ee7cb5e3633502d9a90a85c3c367eccd59a0aba
commit-date: 2024-09-10
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
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.