Skip to content

Allow attribute does not surpress unknown_or_malformed_diagnostic_attributes #135772

Description

@SpecificProtagonist

Code

trait _Trait {}
#[allow(unknown_or_malformed_diagnostic_attributes)]
#[diagnostic::abcdef]
impl _Trait for () {}

Current output

warning: unknown diagnostic attribute
 --> src/lib.rs:3:15
  |
3 | #[diagnostic::abcdef]
  |               ^^^^^^
  |
  = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default

warning: `playground` (lib) generated 1 warning

Desired output

(no warning)

Rationale and extra context

See bevyengine/bevy#17441 for a case where this comes up, where it can't be worked around by introducing a module (because of #79260) or allowing it globally because the lint triggers in a macro.

Rust Version

rustc 1.86.0-nightly (9a1d156f3 2025-01-19)
binary: rustc
commit-hash: 9a1d156f38c51441ee51e5a068f1d0caf4bb0f27
commit-date: 2025-01-19
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 20, 2025
  2. added
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.
    C-bugCategory: This is a bug.
    on Jan 20, 2025
  3. added 3 commits that reference this issue on Sep 8, 2026
    d748c32
    2447c55
    a84ac06
  4. added a commit that references this issue on Sep 8, 2026
    4d6a112
  5. added a commit that references this issue on Sep 14, 2026
    017712a
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-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.L-unknown_or_malformed_diagnostic_attributesLint: unknown_or_malformed_diagnostic_attributesT-compilerRelevant to the compiler 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