Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/defaults/bootstrap.dist.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ download-ci-llvm = false
[rust]
# 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"
channel = "auto-detect"
# Never download a rustc, distributions must build a fresh compiler.
download-rustc = false
lld = true
Expand Down
33 changes: 18 additions & 15 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1540,9 +1540,6 @@ impl Config {
}
}

let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
let ci_channel = file_content.trim_end();

// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
// but not if `bootstrap.toml` hasn't been created.
let mut toml = if !using_default_path || toml_path.exists() {
Expand Down Expand Up @@ -1847,17 +1844,21 @@ impl Config {
let mut lld_enabled = None;
let mut std_features = None;

let is_user_configured_rust_channel =
if let Some(channel) = toml.rust.as_ref().and_then(|r| r.channel.clone()) {
if channel == "auto-detect" {
config.channel = ci_channel.into();
} else {
config.channel = channel;
}
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
let ci_channel = file_content.trim_end();

let toml_channel = toml.rust.as_ref().and_then(|r| r.channel.clone());
let is_user_configured_rust_channel = match toml_channel {
Some(channel) if channel == "auto-detect" => {
config.channel = ci_channel.into();
true
} else {
false
};
}
Some(channel) => {
config.channel = channel;
true
}
None => false,
};

let default = config.channel == "dev";
config.omit_git_hash = toml.rust.as_ref().and_then(|r| r.omit_git_hash).unwrap_or(default);
Expand All @@ -1882,6 +1883,10 @@ impl Config {
&& config.src.join(".cargo/config.toml").exists(),
);

if !is_user_configured_rust_channel && config.rust_info.is_from_tarball() {
config.channel = ci_channel.into();
}

if let Some(rust) = toml.rust {
let Rust {
optimize: optimize_toml,
Expand Down Expand Up @@ -2085,8 +2090,6 @@ impl Config {

config.channel = channel;
}
} else if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
ci_channel.clone_into(&mut config.channel);
}

if let Some(llvm) = toml.llvm {
Expand Down
Loading