Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 862f50c

Browse files
committed
update std uplifting algorithm
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent dbf8155 commit 862f50c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,19 @@ impl Step for Std {
192192

193193
let mut target_deps = builder.ensure(StartupObjects { compiler, target });
194194

195-
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
195+
let mut compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
196196
trace!(?compiler_to_use);
197197

198-
if compiler_to_use != compiler {
198+
if compiler_to_use != compiler
199+
// Never uplift std unless we have compiled stage 2; if stage 2 is compiled,
200+
// uplift it from there.
201+
//
202+
// FIXME: improve `fn compiler_for` to avoid adding stage condition here.
203+
&& compiler.stage > 2
204+
{
205+
if compiler.stage > 2 {
206+
compiler_to_use.stage = 2;
207+
}
199208
trace!(?compiler_to_use, ?compiler, "compiler != compiler_to_use, uplifting library");
200209

201210
builder.ensure(Std::new(compiler_to_use, target));

0 commit comments

Comments
 (0)