Closed
Description
rustdoc doesn't allow anchors in links to primitive types. For example, given this code:
//! [test](str#examples)
cargo doc
produces this warning:
warning: `str#examples` contains an anchor, but links to builtin types are already anchored
--> src/lib.rs:1:12
|
1 | //! [test](str#examples)
| ^^^^^^^^^^^^ contains invalid anchor
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
and the resulting link doesn't point to any part of str
's documentation, but is rather treated as a normal URL relative to the current page.
The warning claims that “links to builtin types are already anchored”, but this does not appear to be correct. For example, this code:
//! [test](str)
produces a link to https://doc.rust-lang.org/nightly/std/primitive.str.html, which does not contain an anchor.
Meta
rustc 1.52.0-nightly (b3e19a221 2021-03-12)
binary: rustc
commit-hash: b3e19a221e63dcffdef87e12eadf1f36a8b90295
commit-date: 2021-03-12
host: powerpc64le-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0
Metadata
Metadata
Assignees
Labels
Area: Intra-doc links, the ability to link to items in docs by nameCategory: This is a bug.Call for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the rustdoc team, which will review and decide on the PR/issue.