Skip to content

Commit 910e83e

Browse files
authored
Rollup merge of #66834 - infinity0:master, r=Mark-Simulacrum
rustbuild fixes When upgrading Debian's rustc to 1.38 I needed these patches: (1) In order to cross-compile rustc 1.38 and take it through the full rustbuild process including install, I needed the first patch. (2) In order to build rustc 1.38 using rustc 1.38 itself I need to set --cap-lints warn, otherwise I get this error: ~~~~ error: unnecessary `unsafe` block --> src/bootstrap/builder.rs:148:19 | 148 | name: unsafe { ::std::intrinsics::type_name::<S>() }, | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here --> src/bootstrap/lib.rs:107:9 | 107 | #![deny(warnings, rust_2018_idioms, unused_lifetimes)] | ^^^^^^^^ = note: `#[deny(unused_unsafe)]` implied by `#[deny(warnings)]` error: aborting due to previous error error: could not compile `bootstrap`. ~~~~ In order to set --cap-lints warn however, I need bootstrap.py not to clobber RUSTFLAGS. (This worked previously, not sure if it was broken intentionally but we would like support for it.)
2 parents 3134368 + 0533249 commit 910e83e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/bootstrap/bootstrap.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,9 @@ def build_bootstrap(self):
643643
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
644644
(os.pathsep + env["LIBRARY_PATH"]) \
645645
if "LIBRARY_PATH" in env else ""
646-
env["RUSTFLAGS"] = "-Cdebuginfo=2 "
646+
# preserve existing RUSTFLAGS
647+
env.setdefault("RUSTFLAGS", "")
648+
env["RUSTFLAGS"] += " -Cdebuginfo=2"
647649

648650
build_section = "target.{}".format(self.build_triple())
649651
target_features = []
@@ -652,13 +654,13 @@ def build_bootstrap(self):
652654
elif self.get_toml("crt-static", build_section) == "false":
653655
target_features += ["-crt-static"]
654656
if target_features:
655-
env["RUSTFLAGS"] += "-C target-feature=" + (",".join(target_features)) + " "
657+
env["RUSTFLAGS"] += " -C target-feature=" + (",".join(target_features))
656658
target_linker = self.get_toml("linker", build_section)
657659
if target_linker is not None:
658-
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "
659-
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes "
660+
env["RUSTFLAGS"] += " -C linker=" + target_linker
661+
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes"
660662
if self.get_toml("deny-warnings", "rust") != "false":
661-
env["RUSTFLAGS"] += "-Dwarnings "
663+
env["RUSTFLAGS"] += " -Dwarnings"
662664

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

src/bootstrap/install.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ install!((self, builder, _config),
260260
};
261261
Rustc, "src/librustc", true, only_hosts: true, {
262262
builder.ensure(dist::Rustc {
263-
compiler: self.compiler,
263+
compiler: builder.compiler(builder.top_stage, self.target),
264264
});
265265
install_rustc(builder, self.compiler.stage, self.target);
266266
};

0 commit comments

Comments
 (0)