Skip to content

rustdoc::missing-crate-level-docs doesn't have a Span or give the name of the affected crate #147458

@estebank

Description

@estebank

Code

.

Current output

error: no documentation found for this crate's top-level module
  |
  = help: The following guide may be of use:
          https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html
  = note: requested on the command line with `-D rustdoc::missing-crate-level-docs`

Desired output

error: no documentation found for the top-level module of crate `foo`
  -> path/to/foo/lib.rs
  |
  = help: The following guide may be of use:
          https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html
  = note: requested on the command line with `-D rustdoc::missing-crate-level-docs`

Rationale and extra context

When enabling the rustdoc lint missing_crate_level_docs in a workspace with multiple crates, the lint provides no information about which crate is affected.

Other cases

Rust Version

rustc 1.91.0-nightly (1ed3cd703 2025-09-06)
binary: rustc
commit-hash: 1ed3cd7030718935a5c5e5c8f6581f36d8be179f
commit-date: 2025-09-06
host: aarch64-apple-darwin
release: 1.91.0-nightly
LLVM version: 21.1.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.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