allow(missing_docs) does not work for macro definitions · Issue #59306 · rust-lang/rust (original) (raw)

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.