Skip to content

allow(missing_docs) does not work for macro definitions #59306

Closed
@fanzeyi

Description

@fanzeyi

It appears deny(missing_docs) will take macros into account since 1.33.0. So I tried to add #[allow(missing_docs)] for some of the macros I don't want to write docs, and it doesn't seem to be working. Minimal reproducible example:

//! Hello
#![deny(missing_docs)]

#[allow(missing_docs)]
#[macro_export]
macro_rules! hello {
    () => ()
}

It will fail with:

error: missing documentation for macro
 --> src/lib.rs:6:1
  |
6 | macro_rules! hello {
  | ^^^^^^^^^^^^^^^^^^
  |
note: lint level defined here
 --> src/lib.rs:2:9
  |
2 | #![deny(missing_docs)]
  |         ^^^^^^^^^^^^

Rust playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=cf5ab453ab982bea1b435676cf46f119

Tested on nightly.

Metadata

Metadata

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.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