Skip to content

Warn for intra-doc links to doc(hidden) items. #144664

@kpreid

Description

@kpreid

Code

pub mod foo {
    /// See also [`crate::bar::bun`].
    /// See also [`bar::bun`][crate::bar::bun].
    /// See also [`bar::bun`](crate::bar::bun).
    pub fn fun() {}
}

#[doc(hidden)]
pub mod bar {
    pub fn bun() {}
}

Reproduction Steps

cargo doc

Expected Outcome

There should be warnings for all of the broken links.

If the item is private instead of hidden, there are currently three private_intra_doc_links warnings. Hidden items should be treated similarly to private ones.

Actual Output

No warnings. The first two links appear as unprocessed brackets, and the last one has crate::bar::bun as a URL.

Version

rustdoc 1.90.0-nightly (498ae9fed 2025-07-28)

@rustbot label +A-intra-doc-links +A-lints
cc @lolbinarycat who seems to be interested in intra-doc link linting.

Metadata

Metadata

Assignees

Labels

A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.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