Skip to content

Commit

Permalink
Revert global default for download-rustc to false
Browse files Browse the repository at this point in the history
And only use `download-rustc = "if-unchanged"` for the `library` and
`tools` profile defaults.
  • Loading branch information
jieyouxu committed Nov 15, 2024
1 parent 251dc8a commit 92c6f0f
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
17 changes: 10 additions & 7 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -496,15 +496,18 @@
#
#debug = false

# Whether to download the stage 1 and 2 compilers from CI.
# This is useful if you are working on tools, doc-comments, or library (you will be able to build
# the standard library without needing to build the compiler).
# Whether to download the stage 1 and 2 compilers from CI. This is useful if you
# are working on tools, doc-comments, or library (you will be able to build the
# standard library without needing to build the compiler).
#
# Set this to "if-unchanged" if you are working on `src/tools`, `tests` or `library` (on CI, `library`
# changes triggers in-tree compiler build) to speed up the build process.
# Set this to "if-unchanged" if you are working on `src/tools`, `tests` or
# `library` (on CI, `library` changes triggers in-tree compiler build) to speed
# up the build process if you don't need to build a compiler from the latest
# commit from `master`.
#
# Set this to `true` to always download or `false` to always use the in-tree compiler.
#download-rustc = "if-unchanged"
# Set this to `true` to always download or `false` to always use the in-tree
# compiler.
#download-rustc = false

# Number of codegen units to use for each compiler invocation. A value of 0
# means "the number of cores on this machine", and 1+ is passed through to the
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/defaults/config.compiler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/defaults/config.dist.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/bootstrap/defaults/config.library.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/defaults/config.tools.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2782,8 +2782,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() {
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/src/utils/change_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
severity: ChangeSeverity::Info,
summary: "`download-rustc='if-unchanged'` is now a default option for library profile.",
},
ChangeInfo {
change_id: 133068,
severity: ChangeSeverity::Info,
summary: "Reverted `download-rustc` defaults; global default is now `false`, and only use `'if-unchanged'` default for library and tools profile.",
},
];

0 comments on commit 92c6f0f

Please sign in to comment.