Skip to content

Rustdoc links to private types on private items generate a warning #74134

Closed
@dennis-hamester

Description

@dennis-hamester

With #72771 merged (current nightly, e.g. 1.46.0-nightly (0c03aee8b 2020-07-05)) , the following code now produces a warning:

struct Private;

pub struct Public {
    /// A private field with a [`Private`] type.
    private: Private,
}

This triggers intra_doc_link_resolution_failure:

warning: `[Private]` public documentation for `private` links to a private item
 --> src/lib.rs:4:12
  |
4 |     /// A [`Private`] field.
  |            ^^^^^^^^^ this item is private
  |
  = note: `#[warn(intra_doc_link_resolution_failure)]` on by default

But rustdoc never actually generates any links to Private, because it wasn't run with --document-private-items. In my opinion it shouldn't emit warning in this case, because documenting the internals can be very useful to contributors or even future me when --document-private-items is used.

There has already been some discussion at the end of #72771, which is where I asked first about whether this change was intentional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-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