about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2024-11-23 23:26:56 +0800
committerJieyou Xu <jieyouxu@outlook.com>2024-11-23 23:47:03 +0800
commitaafd56b87ac45454dd387f632af2eec48b004819 (patch)
treefb230ca1184433bd58a088feb13917bc0aea1fa6 /src/bootstrap
parent5d3c6ee9b34989595d2a72b79e61ca37e949d757 (diff)
downloadrust-aafd56b87ac45454dd387f632af2eec48b004819.tar.gz
rust-aafd56b87ac45454dd387f632af2eec48b004819.zip
bootstrap: revert `rust.download-rustc` global default to `false`
And only default library and tools profile to `rust.download-rustc =
"if-unchanged"`.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/defaults/config.compiler.toml3
-rw-r--r--src/bootstrap/defaults/config.dist.toml1
-rw-r--r--src/bootstrap/defaults/config.library.toml4
-rw-r--r--src/bootstrap/defaults/config.tools.toml3
-rw-r--r--src/bootstrap/src/core/config/config.rs8
5 files changed, 16 insertions, 3 deletions
diff --git a/src/bootstrap/defaults/config.compiler.toml b/src/bootstrap/defaults/config.compiler.toml
index 57a0ca5a718..a737de3bd08 100644
--- a/src/bootstrap/defaults/config.compiler.toml
+++ b/src/bootstrap/defaults/config.compiler.toml
@@ -19,6 +19,9 @@ lto = "off"
 # Forces frame pointers to be used with `-Cforce-frame-pointers`.
 # This can be helpful for profiling at a small performance cost.
 frame-pointers = true
+# Compiler contributors often want to build rustc even without any changes to
+# e.g. check that it builds locally and check the baseline behavior of a
+# compiler built from latest `master` commit.
 download-rustc = false
 
 [llvm]
diff --git a/src/bootstrap/defaults/config.dist.toml b/src/bootstrap/defaults/config.dist.toml
index 4346a9c2dd1..7b381b416ca 100644
--- a/src/bootstrap/defaults/config.dist.toml
+++ b/src/bootstrap/defaults/config.dist.toml
@@ -16,6 +16,7 @@ download-ci-llvm = false
 # We have several defaults in bootstrap that depend on whether the channel is `dev` (e.g. `omit-git-hash` and `download-ci-llvm`).
 # Make sure they don't get set when installing from source.
 channel = "nightly"
+# Never download a rustc, distributions must build a fresh compiler.
 download-rustc = false
 lld = true
 # Build the llvm-bitcode-linker
diff --git a/src/bootstrap/defaults/config.library.toml b/src/bootstrap/defaults/config.library.toml
index 67ceb220524..b43796d6f20 100644
--- a/src/bootstrap/defaults/config.library.toml
+++ b/src/bootstrap/defaults/config.library.toml
@@ -10,7 +10,9 @@ bench-stage = 0
 incremental = true
 # Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
 lto = "off"
-download-rustc = false
+# Download rustc by default for library profile if compiler-affecting
+# directories are not modified. For CI this is disabled.
+download-rustc = "if-unchanged"
 
 [llvm]
 # Will download LLVM from CI if available on your platform.
diff --git a/src/bootstrap/defaults/config.tools.toml b/src/bootstrap/defaults/config.tools.toml
index 76b47a841b3..64097320cab 100644
--- a/src/bootstrap/defaults/config.tools.toml
+++ b/src/bootstrap/defaults/config.tools.toml
@@ -3,6 +3,9 @@
 [rust]
 # This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
 incremental = true
+# Most commonly, tools contributors do not need to modify the compiler, so
+# downloading a CI rustc is a good default for tools profile.
+download-rustc = "if-unchanged"
 
 [build]
 # Document with the in-tree rustdoc by default, since `download-rustc` makes it quick to compile.
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index e706aba977b..f35e8ec948b 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -2786,8 +2786,12 @@ impl Config {
 
         // If `download-rustc` is not set, default to rebuilding.
         let if_unchanged = match download_rustc {
-            None => self.rust_info.is_managed_git_subrepository(),
-            Some(StringOrBool::Bool(false)) => return None,
+            // Globally default for `download-rustc` to `false`, because some contributors don't use
+            // profiles for reasons such as:
+            // - They need to seemlessly switch between compiler/library work.
+            // - They don't want to use compiler profile because they need to override too many
+            //   things and it's easier to not use a profile.
+            None | Some(StringOrBool::Bool(false)) => return None,
             Some(StringOrBool::Bool(true)) => false,
             Some(StringOrBool::String(s)) if s == "if-unchanged" => {
                 if !self.rust_info.is_managed_git_subrepository() {