@@ -1113,6 +1113,19 @@ def build_bootstrap_cmd(self, env):
11131113 else :
11141114 env ["RUSTFLAGS" ] = "-Zallow-features="
11151115
1116+ if not os .path .isfile (self .cargo ()):
1117+ raise Exception ("no cargo executable found at `{}`" .format (self .cargo ()))
1118+ args = [
1119+ self .cargo (),
1120+ "build" ,
1121+ "--jobs=" + self .jobs ,
1122+ "--manifest-path" ,
1123+ os .path .join (self .rust_root , "src/bootstrap/Cargo.toml" ),
1124+ "-Zroot-dir=" + self .rust_root ,
1125+ ]
1126+ # verbose cargo output is very noisy, so only enable it with -vv
1127+ args .extend ("--verbose" for _ in range (self .verbose - 1 ))
1128+
11161129 target_features = []
11171130 if self .get_toml ("crt-static" , build_section ) == "true" :
11181131 target_features += ["+crt-static" ]
@@ -1131,28 +1144,15 @@ def build_bootstrap_cmd(self, env):
11311144 else :
11321145 deny_warnings = self .warnings == "deny"
11331146 if deny_warnings :
1134- env ["RUSTFLAGS" ] += " -Dwarnings"
1147+ args += ["-Zwarnings" ]
1148+ env ["CARGO_BUILD_WARNINGS" ] = "deny"
11351149
11361150 # Add RUSTFLAGS_BOOTSTRAP to RUSTFLAGS for bootstrap compilation.
11371151 # Note that RUSTFLAGS_BOOTSTRAP should always be added to the end of
1138- # RUSTFLAGS to be actually effective (e.g., if we have `-Dwarnings` in
1139- # RUSTFLAGS, passing `-Awarnings` from RUSTFLAGS_BOOTSTRAP should override it).
1152+ # RUSTFLAGS, since that causes RUSTFLAGS_BOOTSTRAP to override RUSTFLAGS.
11401153 if "RUSTFLAGS_BOOTSTRAP" in env :
11411154 env ["RUSTFLAGS" ] += " " + env ["RUSTFLAGS_BOOTSTRAP" ]
11421155
1143- if not os .path .isfile (self .cargo ()):
1144- raise Exception ("no cargo executable found at `{}`" .format (self .cargo ()))
1145- args = [
1146- self .cargo (),
1147- "build" ,
1148- "--jobs=" + self .jobs ,
1149- "--manifest-path" ,
1150- os .path .join (self .rust_root , "src/bootstrap/Cargo.toml" ),
1151- "-Zroot-dir=" + self .rust_root ,
1152- ]
1153- # verbose cargo output is very noisy, so only enable it with -vv
1154- args .extend ("--verbose" for _ in range (self .verbose - 1 ))
1155-
11561156 if "BOOTSTRAP_TRACING" in env :
11571157 args .append ("--features=tracing" )
11581158
0 commit comments