Skip to content

Beta rustc warns on missing documentation for an extern crate even though the docstring is not used by rustdoc #112308

Closed
@elinorbgr

Description

@elinorbgr

minimal example:

#![warn(missing_docs)]

pub extern crate alloc;

Running cargo check on this example outputs no warning on stable 1.70.0, but on either rustc 1.71.0-beta.2 (4e8c9e8e3 2023-06-04) or rustc 1.72.0-nightly (101fa903b 2023-06-04) it outputs the following warning:

warning: missing documentation for an extern crate
 --> src/lib.rs:5:1
  |
5 | pub extern crate alloc;
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/lib.rs:3:9
  |
3 | #![warn(missing_docs)]
  |         ^^^^^^^^^^^^

Adding a docstring does silence the warning, but as far as I can tell this docstring is not used anywhere by rustdoc: adding it has no impact on the generated documentation.

I suppose either the warning is inadequate, or rustdoc should display that docstring.

cc @GuillaumeGomez

Metadata

Metadata

Assignees

No one assigned

    Labels

    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