Skip to content

Add item suggestions for broken intra doc links #74207

Open
@pickfire

Description

@pickfire

The diagnostics for intra-doc links could be improve to match the diagnostics available in rust.

Current error message

warning: `[extend]` cannot be resolved, ignoring it.
   --> src/vec.rs:704:45
    |
704 |     /// Note that this function is same as [`extend`] except that it is specialized to work with
    |                                             ^^^^^^^^ cannot be resolved, ignoring
    |
    = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

The diagnostics should suggest Self::extend(). Note that it should also handle path ambiguity unlike the current diagnostics with struct@, enum@ and others in the original RFC.

Original RFC: https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md
Tracking issue for intra-doc links: #43466

CC @QuietMisdreavus @Manishearth @jyn514

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions