about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2023-04-10 14:13:15 +0530
committerGitHub <noreply@github.com>2023-04-10 14:13:15 +0530
commit6f2fd3e6a21e922f4f2d26b47d894da2f8fdc61b (patch)
tree8ad551b2b50894c79271f870c5a666d184ec29d3
parente327487bd8c7533ba72f21fc6b58e7d4a7f6449e (diff)
parent2b43f25e428ca1065206f424d7b953e2cc606c2e (diff)
downloadrust-6f2fd3e6a21e922f4f2d26b47d894da2f8fdc61b.tar.gz
rust-6f2fd3e6a21e922f4f2d26b47d894da2f8fdc61b.zip
Rollup merge of #110121 - jyn514:check-stage1, r=ozkanonur
Fix `x check --stage 1` when download-rustc is enabled

Helps with https://github.com/rust-lang/rust/issues/81930
-rw-r--r--src/bootstrap/check.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index cd19667139a..f9387a0fc80 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -271,9 +271,17 @@ impl Step for Rustc {
             false,
         );
 
-        let libdir = builder.sysroot_libdir(compiler, target);
-        let hostdir = builder.sysroot_libdir(compiler, compiler.host);
-        add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target));
+        // HACK: This avoids putting the newly built artifacts in the sysroot if we're using
+        // `download-rustc`, to avoid "multiple candidates for `rmeta`" errors. Technically, that's
+        // not quite right: people can set `download-rustc = true` to download even if there are
+        // changes to the compiler, and in that case ideally we would put the *new* artifacts in the
+        // sysroot, in case there are API changes that should be used by tools.  In practice,
+        // though, that should be very uncommon, and people can still disable download-rustc.
+        if !builder.download_rustc() {
+            let libdir = builder.sysroot_libdir(compiler, target);
+            let hostdir = builder.sysroot_libdir(compiler, compiler.host);
+            add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target));
+        }
     }
 }