about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-12-15 10:17:56 +0300
committeronur-ozkan <work@onurozkan.dev>2025-05-30 21:03:49 +0300
commitc5adf58599819d284c6f810a558f57a41567f6f5 (patch)
tree478adfa4a2b2fc410212ac6919ca28b95f43e330 /src
parent5dc0d89abc513770ed919de46210db0ae479a575 (diff)
downloadrust-c5adf58599819d284c6f810a558f57a41567f6f5.tar.gz
rust-c5adf58599819d284c6f810a558f57a41567f6f5.zip
update std uplifting algorithm
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 8a34d644b3a..36b5922020f 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -191,10 +191,17 @@ impl Step for Std {
 
         let mut target_deps = builder.ensure(StartupObjects { compiler, target });
 
-        let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
+        let mut compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
         trace!(?compiler_to_use);
 
-        if compiler_to_use != compiler {
+        if compiler_to_use != compiler
+            // Never uplift std unless we have compiled stage 2; if stage 2 is compiled,
+            // uplift it from there.
+            //
+            // FIXME: improve `fn compiler_for` to avoid adding stage condition here.
+            && compiler.stage > 2
+        {
+            compiler_to_use.stage = 2;
             trace!(?compiler_to_use, ?compiler, "compiler != compiler_to_use, uplifting library");
 
             builder.ensure(Std::new(compiler_to_use, target));