Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint wrong usage of known attributes - spotlight: no_std #3782

Closed
Robbepop opened this issue Feb 18, 2019 · 4 comments
Closed

Lint wrong usage of known attributes - spotlight: no_std #3782

Robbepop opened this issue Feb 18, 2019 · 4 comments

Comments

@Robbepop
Copy link

Robbepop commented Feb 18, 2019

When compiling a no_std crate it already happened multiple times that I forgot the ! after the # in #![no_std] (or similar) attribute specifiers making it a useless #[no_std] causing compilation troubles because I accidentally pulled std due to this. The compiler doesn't warn for misusage of known attributes like no_std and I am not sure if it should. But it would be awesome to have a clippy lint for this situation! Would have saved me hours of debugging already - ashamed.

@Robbepop Robbepop changed the title Lint wrong usage of known attributes Lint wrong usage of known attributes - spotlight: no_std Feb 18, 2019
@Manishearth
Copy link
Member

Manishearth commented Feb 18, 2019 via email

@phansch
Copy link
Member

phansch commented Feb 18, 2019

A similar lint is empty_line_after_outer_attr, but I think you had it directly above an item without any newlines, right?

@petrochenkov
Copy link
Contributor

This should be an error from the compiler, yes.
We are currently lacking a centralized infra for reporting attributes applied to wrong targets though, so these errors are reported very irregularly.
I hope to implement something like rust-lang/rust#57321, but for attribute targets, some time, so this may be fixed in rustc in the future.

@J-ZhengLi
Copy link
Member

seems like it's handled by the unused_attributes lint in rustc (which came after this issue ofc~).

So... closing it as its already done by the compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants