Skip to content

Commit 0164183

Browse files
authored
Rollup merge of rust-lang#64098 - Mark-Simulacrum:always-warn, r=alexcrichton
Ensure edition lints and internal lints are enabled with deny-warnings=false Previously we only passed the deny command line flags if deny-warnings was enabled, but now we either pass -W... or -D... for each of the flags as appropriate. This is also a breaking change to x.py as it changes `--warnings=allow` to `--warnings=warn` which is what that flag actually did; we don't have an allow warnings mode.
2 parents 68b4f75 + fda251b commit 0164183

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/bootstrap/bin/rustc.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,18 @@ fn main() {
119119
cmd.arg(format!("-Cdebuginfo={}", debuginfo_level));
120120
}
121121

122-
if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
123-
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
122+
if env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
124123
// When extending this list, add the new lints to the RUSTFLAGS of the
125124
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
126125
// some code doesn't go through this `rustc` wrapper.
127-
cmd.arg("-Dwarnings");
128-
cmd.arg("-Drust_2018_idioms");
129-
cmd.arg("-Dunused_lifetimes");
126+
cmd.arg("-Wrust_2018_idioms");
127+
cmd.arg("-Wunused_lifetimes");
130128
if use_internal_lints(crate_name) {
131129
cmd.arg("-Zunstable-options");
132-
cmd.arg("-Drustc::internal");
130+
cmd.arg("-Wrustc::internal");
131+
}
132+
if env::var_os("RUSTC_DENY_WARNINGS").is_some() {
133+
cmd.arg("-Dwarnings");
133134
}
134135
}
135136

src/bootstrap/bootstrap.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,9 @@ def build_bootstrap(self):
631631
target_linker = self.get_toml("linker", build_section)
632632
if target_linker is not None:
633633
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "
634+
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes "
634635
if self.get_toml("deny-warnings", "rust") != "false":
635-
env["RUSTFLAGS"] += "-Dwarnings -Drust_2018_idioms -Dunused_lifetimes "
636+
env["RUSTFLAGS"] += "-Dwarnings "
636637

637638
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
638639
os.pathsep + env["PATH"]

src/bootstrap/flags.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct Flags {
3636
// This overrides the deny-warnings configuation option,
3737
// which passes -Dwarnings to the compiler invocations.
3838
//
39-
// true => deny, false => allow
39+
// true => deny, false => warn
4040
pub deny_warnings: Option<bool>,
4141
}
4242

@@ -556,10 +556,10 @@ fn split(s: &[String]) -> Vec<String> {
556556
fn parse_deny_warnings(matches: &getopts::Matches) -> Option<bool> {
557557
match matches.opt_str("warnings").as_ref().map(|v| v.as_str()) {
558558
Some("deny") => Some(true),
559-
Some("allow") => Some(false),
559+
Some("warn") => Some(false),
560560
Some(value) => {
561561
eprintln!(
562-
r#"invalid value for --warnings: {:?}, expected "allow" or "deny""#,
562+
r#"invalid value for --warnings: {:?}, expected "warn" or "deny""#,
563563
value,
564564
);
565565
process::exit(1);

0 commit comments

Comments
 (0)