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: private items get broken_intra_doc_links warning even when using --document-private-items #115788

Closed
hikari-no-yume opened this issue Sep 12, 2023 · 1 comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@hikari-no-yume
Copy link

hikari-no-yume commented Sep 12, 2023

Code

/// Used by [bar::qux].
fn foo() {}

mod bar {
    fn qux() {
        super::foo();
    }
}

Current output

warning: unresolved link to `bar::qux`
 --> foo.rs:1:14
  |
1 | /// Used by [bar::qux].
  |              ^^^^^^^^ no item named `qux` in module `bar`
  |
  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

warning: 1 warning emitted

In addition to the warning, the link shows up as unformatted text (including the square brackets) rather than as a hyperlink.

Desired output

No warning, and a hyperlink in the resulting HTML rather than unlinked text.

Rationale and extra context

It's surprising that the link is unresolved, considering that the item linked to has a valid path, and a documentation page has been generated for it! If I were to manually write out the path of the generated HTML file, the link would work.

Anything else?

My project has this problem in the current trunk revision:

warning: unresolved link to `crate::frameworks::core_animation::composition`
   --> src/frameworks/core_graphics/cg_bitmap_context.rs:460:19
    |
460 | ...cut for [crate::frameworks::core_animation::composition]. This is a
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `composition` in module `core_animation`
    |
    = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

warning: unresolved link to `super::cg_image::CGImageGetDataProvider`
   --> src/frameworks/core_graphics/cg_data_provider.rs:115:25
    |
115 | /// This is for use by [super::cg_image::CGImageGetDataProvider].
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `CGImageGetDataProvider` in module `cg_image`

warning: unresolved link to `crate::environment::mutex`
 --> src/libc/pthread/mutex.rs:8:10
  |
8 | //! See [crate::environment::mutex] for the internal implementation.
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `mutex` in module `environment`

warning: `touchHLE` (lib doc) generated 3 warnings

The project is not a library, so all the documentation is there to help others understand the code. I set --document-private-items using .cargo/config.toml; if I didn't use that flag, the generated documentation would be useless. I make extensive use of intra-doc links to explain how different components fit together.

@hikari-no-yume hikari-no-yume added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 12, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 12, 2023
@fmease fmease added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed A-diagnostics Area: Messages for errors, warnings, and lints needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 12, 2023
@fmease fmease assigned fmease and unassigned fmease Sep 25, 2023
@fmease
Copy link
Member

fmease commented Sep 25, 2023

Closing as duplicate of #83049.

@fmease fmease closed this as not planned Won't fix, can't repro, duplicate, stale Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. 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