-
Notifications
You must be signed in to change notification settings - Fork 14k
Add lint for wrong attributes #10316
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
Conversation
src/librustc/middle/lint.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may also want to include
no_implicit_preludelicense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no_implicit_prelude can be used on items:
#[no_implicit_prelude]
mod x {
fn f() -> Option<int> { None } // error: use of undeclared type name `Option`
}
I initially included license, copyright and comment but I've found we don't use them at all, so I don't know how good including them is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're not explicitly used anywhere currently, but all crate attributes contribute to the crate hash currently (but that may not stick around very long).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably fine to leave them out for now.
|
@klutzy any progress on this? |
|
I've completely forgot this! I've implemented unknown-attr lint but haven't added tests yet. It also needs update to reflect current attributes. |
|
I think it's done. r? |
|
@klutzy needs rebase |
This also moves `#[auto_{en,de}code]` checker from syntax to lint.
This also enables two tests properly.
|
rebase done. |
This patchset makes warning if crate-level attribute is used at other places, obsolete attributed is used, or unknown attribute is used, since they are usually from mistakes. Closes #3348
…lang/rust#10316. Also moved comment attr to desc which seems more appropriate.
… r=Manishearth Add `suspicious_command_arg_space` lint Fixes rust-lang#10316 --- changelog: New lint: [`suspicious_command_arg_space`] [rust-lang#10317](rust-lang/rust-clippy#10317) <!-- changelog_checked -->
This patchset makes warning if crate-level attribute is used at other places, obsolete attributed is used, or unknown attribute is used, since they are usually from mistakes.
Closes #3348