Skip to content

Commit c86ea34

Browse files
Ensure all warnings are emitted even on warnings=warn
1 parent 5f42f3e commit c86ea34

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
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"]

0 commit comments

Comments
 (0)