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

cross-crate intra-doc failures generate a broken link instead of stripping the link #96064

Open
ben0x539 opened this issue Apr 15, 2022 · 3 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 C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@ben0x539
Copy link
Contributor

Example: tracing-subscriber defines the MakeWriter trait with the make_writer method whose docs link to the Metadata type in tracing_core: https://docs.rs/tracing-subscriber/0.3.11/tracing_subscriber/fmt/writer/trait.MakeWriter.html#method.make_writer_for

tracing-appender has a type that implements MakeWriter and hence its docs reproduce the docs for the trait's methods: https://docs.rs/tracing-appender/0.2.2/tracing_appender/rolling/struct.RollingFileAppender.html#method.make_writer_for

The intra-doc link to Metadata didn't get resolved, and it just 404s: https://docs.rs/tracing-appender/0.2.2/tracing_appender/rolling/tracing_core::Metadata. tracing-core isn't a direct dependency of tracing-appender so I guess naming an item from tracing-core "in tracing-appender" doesn't work, even though the item is in scope where the doc comment physically exists.

Those crates live in a workspace at tokio-rs/tracing.

Here's a smaller example without a workspace: https://ben0x539.github.io/intradoclinkbreakage/im/target/doc/im/struct.Im.html, from https://github.com/ben0x539/intradoclinkbreakage.

idk if this is a known limitation, and I'm currently unable to think of the right search terms to find out. Seems unfortunate though.

Meta

 $ rustdoc --version --verbose
rustdoc 1.62.0-nightly (e7575f967 2022-04-14)
binary: rustdoc
commit-hash: e7575f9670f3c837def3d186ae09366c75c7632e
commit-date: 2022-04-14
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0
@ben0x539 ben0x539 added the C-bug Category: This is a bug. label Apr 15, 2022
@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Apr 15, 2022
@jyn514
Copy link
Member

jyn514 commented Jun 20, 2022

This is an intentional decision by cargo: rust-lang/cargo#8296 (comment)

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2022
@ben0x539
Copy link
Contributor Author

Cargo decisions aside, emitting broken links sounds like a bug to me. Should we just strip the links in these cases where we cannot resolve them?

@jyn514
Copy link
Member

jyn514 commented Aug 24, 2022

@ben0x539 I think what's going on is #56922; we don't report the broken link because we don't think it's controlled by the same author as the original crate.

That said, it's weird we don't strip the link, I think we do normally for failures in the same crate. Would be good to test that and see why it differs.

@jyn514 jyn514 reopened this Aug 24, 2022
@jyn514 jyn514 changed the title no intra-doc links for items from transitive dep in docs inherited from a Trait from a direct dep cross-crate intra-doc failures generate a broken link instead of stripping the link Aug 24, 2022
@jyn514 jyn514 added the A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate label Aug 24, 2022
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 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

3 participants