Skip to content

Commit 935c1c8

Browse files
committed
rustbuild: allow disabling deny(warnings) for bootstrap
When deny-warnings is not specified or set to true, the behaviour is the same as before. When deny-warnings is set to false, warnings are now allowed Fixes #63911 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
1 parent 0444b9f commit 935c1c8

File tree

6 files changed

+5
-17
lines changed

6 files changed

+5
-17
lines changed

src/bootstrap/bin/main.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
//! parent directory, and otherwise documentation can be found throughout the `build`
66
//! directory in each respective module.
77
8-
// NO-RUSTC-WRAPPER
9-
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
10-
118
use std::env;
129

1310
use bootstrap::{Config, Build};

src/bootstrap/bin/rustc.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
//! switching compilers for the bootstrap and for build scripts will probably
1616
//! never get replaced.
1717
18-
// NO-RUSTC-WRAPPER
19-
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
20-
2118
use std::env;
2219
use std::ffi::OsString;
2320
use std::io;
@@ -124,8 +121,9 @@ fn main() {
124121

125122
if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
126123
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
127-
// When extending this list, search for `NO-RUSTC-WRAPPER` and add the new lints
128-
// there as well, some code doesn't go through this `rustc` wrapper.
124+
// When extending this list, add the new lints to the RUSTFLAGS of the
125+
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
126+
// some code doesn't go through this `rustc` wrapper.
129127
cmd.arg("-Dwarnings");
130128
cmd.arg("-Drust_2018_idioms");
131129
cmd.arg("-Dunused_lifetimes");

src/bootstrap/bin/rustdoc.rs

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
//!
33
//! See comments in `src/bootstrap/rustc.rs` for more information.
44
5-
// NO-RUSTC-WRAPPER
6-
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
7-
85
use std::env;
96
use std::process::Command;
107
use std::path::PathBuf;

src/bootstrap/bootstrap.py

+2
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,8 @@ 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+
if self.get_toml("deny-warnings", "rust") != "false":
635+
env["RUSTFLAGS"] += "-Dwarnings -Drust_2018_idioms -Dunused_lifetimes "
634636

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

src/bootstrap/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@
103103
//! More documentation can be found in each respective module below, and you can
104104
//! also check out the `src/bootstrap/README.md` file for more information.
105105
106-
// NO-RUSTC-WRAPPER
107-
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
108-
109106
#![feature(core_intrinsics)]
110107
#![feature(drain_filter)]
111108

src/build_helper/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// NO-RUSTC-WRAPPER
2-
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
3-
41
use std::fs::File;
52
use std::path::{Path, PathBuf};
63
use std::process::{Command, Stdio};

0 commit comments

Comments
 (0)