Skip to content

Clarify what -D warnings or -F warnings does #46136

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

Merged
merged 2 commits into from
Dec 6, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ Available lint options:
println!("Lint groups provided by rustc:\n");
println!(" {} {}", padded("name"), "sub-lints");
println!(" {} {}", padded("----"), "---------");
println!(" {} {}", padded("warnings"), "all built-in lints");
println!(" {} {}", padded("warnings"), "all lints activated to the warning level");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I don't find this phrasing very clear. "The warning level" sounds to me like something that one can control independently. Perhaps "all lints set to warn", or "all lints that are set to issue warnings"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a lint that defaults to allow, but you set it explicitly to warn, and then you do #[deny(warnings)], is that lint then denied?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I don't find this phrasing very clear.

Yea, I struggled to find a good wording. Thanks for the suggestions, I used the second one for now.

If you have a lint that defaults to allow, but you set it explicitly to warn, and then you do #[deny(warnings)], is that lint then denied?

Yes.

#![deny(warnings)]
fn main() {
    Box::new(());
}
$ rustc -W box-pointers a.rs
error: type uses owned (Box type) pointers: std::boxed::Box<()>
 --> box.rs:3:5
  |
3 |     Box::new(());
  |     ^^^^^^^^^^^^
  |
note: lint level defined here
 --> box.rs:1:9
  |
1 | #![deny(warnings)]
  |         ^^^^^^^^
  = note: #[deny(box_pointers)] implied by #[deny(warnings)]

error: aborting due to previous error


let print_lint_groups = |lints: Vec<(&'static str, Vec<lint::LintId>)>| {
for (name, to) in lints {
Expand Down