Skip to content

New compiler flags: -W all -W no-all -W err-all #2453

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

bstrie
Copy link
Contributor

@bstrie bstrie commented May 27, 2012

Use RUST_LOG=rustc::driver=2 to see the effect of the new options.

When rustc is invoked with -W all, it sets the lint flags equal to the keys of the master lint flags hashtable. As per the convention of the individual lint flags, using -W no-all will do the same, but prepends each lint flag with no-, thereby disabling it. Using -W err-all prepends all lint flags with err- to abort compilation upon a lint warning.

Here's the test file I used:

use std;
import std::bitv;  // unused-import warning

fn main() {
    while true {  // while-true warning
        io::println("hello");
        log(error, "world");  // old-vecs warning
        #error("%?", "again!");  // lots of old-vecs warnings
        break;
    }
}

Use RUST_LOG=rustc::driver=2 to see the effect of the new options.
@brson
Copy link
Contributor

brson commented May 30, 2012

This looks good, but I would like to do this in a slightly different way. Instead of creating command line flags can we just create lint checks called 'all' and 'err-all'? That way they can also be activated via the crate warn attributes (#[warn(all)]). The lint pass itself can interpret 'all', 'no_all' and 'err_all' specially to flip all the checks on/off, etc.

In general we want compile options to be specified via attributes, and only secondarily via the command line.

@bstrie
Copy link
Contributor Author

bstrie commented May 31, 2012

Can do.

@brson
Copy link
Contributor

brson commented Jun 2, 2012

@msullivan and @nikomatsakis have been eyeing the lint pass as well lately.

@brson
Copy link
Contributor

brson commented Jul 10, 2012

Closing this.

@brson brson closed this Jul 10, 2012
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 22, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants