Skip to content

Known but incorrect attributes over statements/expressions are ignored. #43988

Closed
@oyvindln

Description

@oyvindln

I tried to look for this, but I couldn't find an existing issue. Or is this expected behaviour?

Putting attributes that exist (though the arguments can be bogus) seem to be ignored when one would expect an error, or at least a warning. E.g like this:

#[repr(bogus_statement)]
let x = 0;

or

#[inline(bogus_statement)]
let x = 0;

This seems to be the case on stable, beta and nightly.

More examples here: https://play.rust-lang.org/?gist=b48bfc076d29c770d8d2c81f2f99f0bb

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions