Closed
Description
Similar to but not the same as #74207. Right now rustdoc reports the same error for all the following cases:
/// [<invalid syntax>]
/// [path::to::nonexistent::module]
/// [f::A]
/// [S::A]
/// [S::fmt]
pub fn f() {}
#[derive(Debug)]
pub struct S;
warning: unresolved link to `path::to::nonexistent::module`
--> /dev/stdin:2:6
|
2 | /// [path::to::nonexistent::module]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unresolved link
|
= note: `#[warn(broken_intra_doc_links)]` on by default
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
However we can give much more helpful errors:
1 | /// [<invalid syntax>]
| ^^^^^^^^^^^^^^^^^^ not valid syntax for an intra-doc link
2 | /// [path::to::nonexistent::module]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type or module `path`
3 | /// [f::A]
| ^^^^^^ functions cannot have associated items
4 | /// [S::A]
| ^^^^^^ `S` does not have an associated item `A` in scope. help: try importing a trait that defines that item
5 | /// [S::fmt]
| ^^^^^^ `S` does not have an associated item `fmt` in scope. help: S implements `std::fmt::Debug`, try importing it.
Most of these do not require special help from rustc_resolve
(that would just let rustdoc duplicate less code).
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Intra-doc links, the ability to link to items in docs by nameCategory: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the rustdoc team, which will review and decide on the PR/issue.