You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered this oddity while writing docs for a crate. Apologies if this isn't the correct place to report a bug, there didn't appear to be a rustdoc specific tracker anywhere I could find.
I created a new crate cargo new and messed around till I could reproduce the issue. This is the minimum reproducible example:
warning: redundant explicit link target
--> src\main.rs:1:23
|
1 | //! [**`SomeTrait`**](SomeTrait):
| ----------- ^^^^^^^^^ explicit target is redundant
| |
| because label contains path that resolves to same destination
|
= note: when a link's destination is not specified,
the label is used to resolve intra-doc links
= note: `#[warn(rustdoc::redundant_explicit_links)]` on by default
help: remove explicit link target
|
1 | //! [`SomeTrait`]:
| ~~~~~~~~~~~~~
However if you remove the explicit link you get this:
warning: unresolved link to `**SomeTrait**`
--> src\main.rs:1:6
|
1 | //! [**`SomeTrait`**]:
| ^^^^^^^^^^^^^^^ no item named `**SomeTrait**` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
I originally thought the : might be the issue. Maybe it was confusing it with a link fragment as described in the docs but you get the same error without it:
warning: unresolved link to `**SomeTrait**`
--> src\main.rs:1:6
|
1 | //! [**`SomeTrait`**]
| ^^^^^^^^^^^^^^^ no item named `**SomeTrait**` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
GuillaumeGomez
added
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Mar 28, 2024
Rollup merge of rust-lang#123162 - GuillaumeGomez:fix-123158, r=notriddle
Correctly get complete intra-doc link data
Fixesrust-lang#123158.
The problem was that we didn't take into account cases where there would be content other than backticks into the intra doc link definition.
r? `@notriddle`
I discovered this oddity while writing docs for a crate. Apologies if this isn't the correct place to report a bug, there didn't appear to be a rustdoc specific tracker anywhere I could find.
I created a new crate
cargo new
and messed around till I could reproduce the issue. This is the minimum reproducible example:This returns this warning:
However if you remove the explicit link you get this:
I originally thought the
:
might be the issue. Maybe it was confusing it with a link fragment as described in the docs but you get the same error without it:Meta
Confirmed to exist on stable and nightly.
Stable
rustc --version --verbose
:Nightly
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: