diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 8be70c5a2871..9c7fba0dd780 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -111,9 +111,6 @@ fn main() { cmd.arg("-Zunstable-options"); cmd.arg("-Wrustc::internal"); } - if env::var_os("RUSTC_DENY_WARNINGS").is_some() { - cmd.arg("-Dwarnings"); - } } if let Some(target) = target { diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 095770f76508..60673cf7cdd3 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1055,8 +1055,8 @@ impl<'a> Builder<'a> { cargo.env("RUSTC_VERBOSE", self.verbosity.to_string()); - if self.config.deny_warnings { - cargo.env("RUSTC_DENY_WARNINGS", "1"); + if self.config.deny_warnings && !mode.is_tool() { + rustflags.arg("-Dwarnings"); } // Throughout the build Cargo can execute a number of build scripts