Skip to content

Allow attribute does not surpress unknown_or_malformed_diagnostic_attributes #135772

Open
@SpecificProtagonist

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

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