-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
Related #135897
After shadowing a primitive with a type-alias, it seems impossible to disambiguate a rustdoc link to the type-alias. Using the type@
disambiguator does not help.
struct Foo;
type f32 = Foo;
#[doc = "this function returns [`type@f32`]"]
fn my_fn() -> f32;
I ran
$> cargo doc
warning: `f32` is both a type alias and a primitive type
...
= note: ambiguous link
= help: to link to the type alias, prefix with `type@`: type@f32
= help: to link to the primitive type, prefix with `prim@`: prim@f32
Meta
rustc --version --verbose
:
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5
Present in nightly too. cargo 1.90.0-nightly (409fed7dc 2025-06-23)
. But the diagnostic is slightly different:
warning: `f32` is both a type alias and a primitive type
3 | #[doc = "this function returns [`type@f32`]"]
| ^^^^^^^^ ambiguous link
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
help: to link to the primitive type, prefix with `prim@`
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.