Skip to content

Polish missing_doc_code_examples tests and the lint itself #154640

Open

Description

@GuillaumeGomez

@lolbinarycat made a very detailed list of what remains to be done for this lint to be complete here. I will not mark this issue as E-Easy or as mentored because some points here will require discussions with the team.

From those mentioned in the above PR (checked=tests exist):

  • Impl blocks
  • Enum variants
  • Struct/union fields
  • (associated) Type aliases
  • Statics/constants
  • Modules
  • Inlined reexports (cross-crate)
  • Inlined reexports (intra-crate)
  • Non-inlined reexports (cross-crate)
  • Non-inlined reexports (intra-crate)
  • Inherient associated constants
  • Trait associated constants
  • Required trait associated types
  • Optional trait associated types

Additional tests needed:

  • All 3 kinds of macros (v2, macro_rules, proc_macro). Currently these (at least macro_rules macros) are not linted on, but there's a solid argument they should be.
  • Trait definitions
  • Trait items in a trait definition (all of them, including both required and non-required methods)
  • pub extern crate items.
  • Everything that can appear in an extern block (functions, statics, and types)

In addition to all this: private/hidden items are not checked (also clarify if that behavior is changed by --document-private-items and/or --document-hidden-items).

Additionally, we should clarify what counts as a "code example". Does it have to be a doctest (i.e. does ignore not count)? Any rust code block? Any code block? Once we decide on a behavior we want, we'll also need tests for that behavior.

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Mar 31, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 31, 2026
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 31, 2026
  4. lolbinarycat commented on Apr 1, 2026

    @lolbinarycat
    Contributor

    I'm gonna take a pass at making this work better with macros.

  5. added a commit that references this issue on Apr 3, 2026
  6. added a commit that references this issue on Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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