Closed
Description
Code
Example code:
#![deny(rustdoc::broken_intra_doc_links)]
use std::marker::PhantomData;
pub trait Bar<T> {
fn bar(&self);
}
pub struct Foo<U>(PhantomData<U>);
impl<T, U> Bar<T> for Foo<U> {
fn bar(&self) {}
}
/// link to [`Foo::bar`]
fn main() {}
Version it worked on
docs build successfully on 1.57.0:
$ cargo +1.57.0 --version
cargo 1.57.0 (b2e52d7ca 2021-10-21)
$ cargo +1.57.0 doc
Documenting trait-link-example v0.1.0 (/tmp/trait-link-example)
Finished dev [unoptimized + debuginfo] target(s) in 0.53s
Version with regression
docs fail to build on 1.59.0-nightly (358e79fe5 2022-01-04):
$ cargo +nightly-2022-01-07 --version
cargo 1.59.0-nightly (358e79fe5 2022-01-04)
$ cargo +nightly-2022-01-07 doc
Documenting trait-link-example v0.1.0 (/tmp/trait-link-example)
error: unresolved link to `Foo::bar`
--> src/main.rs:15:15
|
15 | /// link to [`Foo::bar`]
| ^^^^^^^^ the struct `Foo` has no field or associated item named `bar`
|
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![deny(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: could not document `trait-link-example`
Caused by:
process didn't exit successfully: `rustdoc --edition=2018 --crate-type bin --crate-name trait_link_example src/main.rs -o /tmp/trait-link-example/target/doc --error-format=json --json=diagnostic-rendered-ansi,future-incompat --document-private-items -C metadata=af2f029e3f5db9a3 -L dependency=/tmp/trait-link-example/target/debug/deps --crate-version 0.1.0` (exit status: 1)
The generics appear necessary for the bug. Removing them from either the type or the trait resolves the failure.