Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc links are broken when glob reexporting items from a doc(hidden) module in another crate. #127445

Open
kpreid opened this issue Jul 7, 2024 · 0 comments
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@kpreid
Copy link
Contributor

kpreid commented Jul 7, 2024

Rustdoc silently (no warnings) generates broken links when the item being linked to is glob-reexported from a module with the #[doc(hidden)] attribute that is from a different crate. This happens regardless of which crate the link is written in.

To reproduce, run cargo doc on two crates foo and bar with the following contents:

// foo/src/lib.rs
#[doc(hidden)]
pub mod hidden_module {
    /// [`FooOne`] [`FooTwo`] [`FooThree`]
    pub struct FooOne;
    pub struct FooTwo;
    pub struct FooThree;
}
// bar/src/lib.rs
pub use foo::hidden_module::{FooTwo, *};

/// [`FooOne`] [`FooTwo`] [`FooThree`]
pub struct Bar;

The links to FooOne and FooThree are broken as if they were unknown names, even though rustdoc emits no warnings about them like it usually does for broken links, and the documentation is otherwise functional.

Meta

rustc --version --verbose:

rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-apple-darwin
release: 1.79.0
LLVM version: 18.1.7

Also reproduces on nightly.

@rustbot label +T-rustdoc

@kpreid kpreid added the C-bug Category: This is a bug. label Jul 7, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 7, 2024
@saethlin saethlin added A-rustdoc-ui Area: Rustdoc UI (generated HTML) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 7, 2024
@fmease fmease added A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants