Skip to content

Commit 6f2fd3e

Browse files
authored
Rollup merge of rust-lang#110121 - jyn514:check-stage1, r=ozkanonur
Fix `x check --stage 1` when download-rustc is enabled Helps with rust-lang#81930
2 parents e327487 + 2b43f25 commit 6f2fd3e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/bootstrap/check.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,17 @@ impl Step for Rustc {
271271
false,
272272
);
273273

274-
let libdir = builder.sysroot_libdir(compiler, target);
275-
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
276-
add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target));
274+
// HACK: This avoids putting the newly built artifacts in the sysroot if we're using
275+
// `download-rustc`, to avoid "multiple candidates for `rmeta`" errors. Technically, that's
276+
// not quite right: people can set `download-rustc = true` to download even if there are
277+
// changes to the compiler, and in that case ideally we would put the *new* artifacts in the
278+
// sysroot, in case there are API changes that should be used by tools. In practice,
279+
// though, that should be very uncommon, and people can still disable download-rustc.
280+
if !builder.download_rustc() {
281+
let libdir = builder.sysroot_libdir(compiler, target);
282+
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
283+
add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target));
284+
}
277285
}
278286
}
279287

0 commit comments

Comments
 (0)