Skip to content

Commit 9e108f8

Browse files
authored
Rollup merge of #112089 - Kobzol:bootstrap-warnings, r=jyn514
Add `--warnings warn` flag to `x.py` So that bootstrap itself can be built with warnings not being treated as errors. Fixes: #76805 r? ```@jyn514```
2 parents aee05c7 + 023e6c4 commit 9e108f8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/bootstrap/bootstrap.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ def bootstrap_binary(self):
835835
"""
836836
return os.path.join(self.build_dir, "bootstrap", "debug", "bootstrap")
837837

838-
def build_bootstrap(self, color, verbose_count):
838+
def build_bootstrap(self, color, warnings, verbose_count):
839839
"""Build bootstrap"""
840840
env = os.environ.copy()
841841
if "GITHUB_ACTIONS" in env:
@@ -894,7 +894,11 @@ def build_bootstrap(self, color, verbose_count):
894894
if target_linker is not None:
895895
env["RUSTFLAGS"] += " -C linker=" + target_linker
896896
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes"
897-
if self.get_toml("deny-warnings", "rust") != "false":
897+
if warnings == "default":
898+
deny_warnings = self.get_toml("deny-warnings", "rust") != "false"
899+
else:
900+
deny_warnings = warnings == "deny"
901+
if deny_warnings:
898902
env["RUSTFLAGS"] += " -Dwarnings"
899903

900904
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
@@ -987,6 +991,7 @@ def parse_args():
987991
parser.add_argument('--color', choices=['always', 'never', 'auto'])
988992
parser.add_argument('--clean', action='store_true')
989993
parser.add_argument('--json-output', action='store_true')
994+
parser.add_argument('--warnings', choices=['deny', 'warn', 'default'], default='default')
990995
parser.add_argument('-v', '--verbose', action='count', default=0)
991996

992997
return parser.parse_known_args(sys.argv)[0]
@@ -1052,7 +1057,7 @@ def bootstrap(args):
10521057
# Fetch/build the bootstrap
10531058
build.download_toolchain()
10541059
sys.stdout.flush()
1055-
build.build_bootstrap(args.color, verbose_count)
1060+
build.build_bootstrap(args.color, args.warnings, verbose_count)
10561061
sys.stdout.flush()
10571062

10581063
# Run the bootstrap

0 commit comments

Comments
 (0)