Skip to content

#[deny(missing_docs)] ignores exported macro_rules! #56334

Description

@kaikalii

If my crate exports a macro_rules! macro, the deny(missing_docs) attribute has no effect even though it probably should.

The following code should, at the very least, provide a warning

#[deny(missing_docs)]
#[macro_export]
macro_rules! foo {
    () => {}
}

Preventing this code from compiling would likely break some backwards compatability, but I don't see why it shouldn't at least give a warning.

Activity

  1. added
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
    T-langRelevant to the language team
    on Nov 30, 2018
  2. Centril commented on Nov 30, 2018

    @Centril
    Contributor

    cc @petrochenkov @rust-lang/lang I cannot decide whether this is expected behavior or not, but it makes sense that missing_docs should fire on exported macros.

  3. cramertj commented on Dec 3, 2018

    @cramertj
    Member

    Preventing this code from compiling would likely break some backwards compatability

    We don't guarantee backwards-compatibility for #![deny(warnings)], otherwise we would never be able to introduce a new warning. I agree that missing deny(missing_docs) should error on crate-exported macros with no documentation.

  4. scottmcm commented on Dec 13, 2018

    @scottmcm
    Member

    Lang team discussion agreed with the two comments above; the lint should warn for this.

  5. nnethercote commented on Jan 14, 2019

    @nnethercote
    Contributor

    This broke compilation of existing code in the rustc-perf benchmark suite, see rust-lang/rustc-perf#325

    I see the comment "We don't guarantee backwards-compatibility for #![deny(warnings)]" above, but I thought it might be useful to note some practical consequences.

  6. cramertj commented on Jan 14, 2019

    @cramertj
    Member

    @nnethercote Seems like that suite should set -cap-lints=allow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions