Closed
Description
When attempting to use intra-rustdoc links to link to *const T
/*mut T
methods (the pointer
primitive type in the std docs), the link is not resolved properly.
This minimal reproduction:
#![deny(rustdoc::broken_intra_doc_links)]
/// [std::pointer::offset]
pub struct MyStruct;
fails like this:
:; cargo doc
Documenting rustdoc-repro v0.1.0 (/home/eliza/Code/rustdoc-repro)
error: unresolved link to `std::pointer::offset`
--> src/lib.rs:3:6
|
3 | /// [std::pointer::offset]
| ^^^^^^^^^^^^^^^^^^^^ no item named `pointer` in module `std`
|
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![deny(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: could not document `rustdoc-repro`
Caused by:
process didn't exit successfully: `rustdoc --edition=2018 --crate-type lib --crate-name rustdoc_repro src/lib.rs -o /home/eliza/Code/rustdoc-repro/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/eliza/Code/rustdoc-repro/target/debug/deps --crate-version 0.1.0` (exit status: 1)
I noticed that PR #58642 fixed intra-doc links to methods on other primitive types, but the match
added in that change doesn't include pointer
:
https://github.com/tspiteri/rust/blob/aa0fa752c455eca11db012be76caa94b15804350/src/librustdoc/passes/collect_intra_doc_links.rs#L607-L625
Meta
This issue occurs on stable rustdoc
:
rustdoc --version --verbose
:
rustdoc 1.53.0 (53cb7b09b 2021-06-17)
binary: rustdoc
commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
commit-date: 2021-06-17
host: x86_64-unknown-linux-gnu
release: 1.53.0
LLVM version: 12.0.1
...and on nightly:
rustdoc --version --verbose
:
rustdoc 1.55.0-nightly (59216858a 2021-07-18)
binary: rustdoc
commit-hash: 59216858a323978a97593cba22b5ed84350a3783
commit-date: 2021-07-18
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1