about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-31 11:19:08 +0200
committerGitHub <noreply@github.com>2023-05-31 11:19:08 +0200
commit9e108f89222e10c3ccd6a899a6b1ea71a91fc5ea (patch)
tree69fb4fe62f45dc6eb9b520fa015bc37cf36ffc5a
parentaee05c74e190c8d435cb6269256e448fc7e0a684 (diff)
parent023e6c4be3785d0d8260b3c0d4fd87b88d9b48d9 (diff)
downloadrust-9e108f89222e10c3ccd6a899a6b1ea71a91fc5ea.tar.gz
rust-9e108f89222e10c3ccd6a899a6b1ea71a91fc5ea.zip
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: https://github.com/rust-lang/rust/issues/76805

r? ```@jyn514```
-rw-r--r--src/bootstrap/bootstrap.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 75df5345169..473fdbe1edc 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -835,7 +835,7 @@ class RustBuild(object):
         """
         return os.path.join(self.build_dir, "bootstrap", "debug", "bootstrap")
 
-    def build_bootstrap(self, color, verbose_count):
+    def build_bootstrap(self, color, warnings, verbose_count):
         """Build bootstrap"""
         env = os.environ.copy()
         if "GITHUB_ACTIONS" in env:
@@ -894,7 +894,11 @@ class RustBuild(object):
         if target_linker is not None:
             env["RUSTFLAGS"] += " -C linker=" + target_linker
         env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes"
-        if self.get_toml("deny-warnings", "rust") != "false":
+        if warnings == "default":
+            deny_warnings = self.get_toml("deny-warnings", "rust") != "false"
+        else:
+            deny_warnings = warnings == "deny"
+        if deny_warnings:
             env["RUSTFLAGS"] += " -Dwarnings"
 
         env["PATH"] = os.path.join(self.bin_root(), "bin") + \
@@ -987,6 +991,7 @@ def parse_args():
     parser.add_argument('--color', choices=['always', 'never', 'auto'])
     parser.add_argument('--clean', action='store_true')
     parser.add_argument('--json-output', action='store_true')
+    parser.add_argument('--warnings', choices=['deny', 'warn', 'default'], default='default')
     parser.add_argument('-v', '--verbose', action='count', default=0)
 
     return parser.parse_known_args(sys.argv)[0]
@@ -1052,7 +1057,7 @@ def bootstrap(args):
     # Fetch/build the bootstrap
     build.download_toolchain()
     sys.stdout.flush()
-    build.build_bootstrap(args.color, verbose_count)
+    build.build_bootstrap(args.color, args.warnings, verbose_count)
     sys.stdout.flush()
 
     # Run the bootstrap