From: Josh Stone Date: Wed, 16 May 2018 00:48:02 +0000 (-0700) Subject: Ensure libraries built in stage0 have unique metadata X-Git-Tag: archive/raspbian/1.27.2+dfsg1-1+rpi1^2~18 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=71f12f51a9d5bb846f7d493e41cf1a463db34bfa;p=rustc.git Ensure libraries built in stage0 have unique metadata Issue #50786 shows a case with local rebuild where the libraries built by stage0 had the same suffix as stage0's own, and were accidentally loaded by that stage0 rustc when compiling `librustc_trans`. Now we set `__CARGO_DEFAULT_LIB_METADATA` to "bootstrap" during stage0, rather than the release channel like usual, so the library suffix will always be completely distinct from the stage0 compiler. Gbp-Pq: Name u-0001-Ensure-libraries-built-in-stage0-have-unique-metadat.patch --- diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 9c35cb7f50..44d7b94fc0 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -567,7 +567,15 @@ impl<'a> Builder<'a> { // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005 // Force cargo to output binaries with disambiguating hashes in the name - cargo.env("__CARGO_DEFAULT_LIB_METADATA", &self.config.channel); + let metadata = if compiler.stage == 0 { + // Treat stage0 like special channel, whether it's a normal prior- + // release rustc or a local rebuild with the same version, so we + // never mix these libraries by accident. + "bootstrap" + } else { + &self.config.channel + }; + cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata); let stage; if compiler.stage == 0 && self.local_rebuild {