Skip to content

Commit cce6f03

Browse files
committed
use download-rustc="if-unchanged" as default whenever possible
"whenever possible" means applying it if `download-rustc` isn't explicitly set and the source is Git-managed. Signed-off-by: onur-ozkan <[email protected]>
1 parent 76b6090 commit cce6f03

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Diff for: src/bootstrap/src/core/config/config.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -2756,9 +2756,19 @@ impl Config {
27562756

27572757
// If `download-rustc` is not set, default to rebuilding.
27582758
let if_unchanged = match download_rustc {
2759-
None | Some(StringOrBool::Bool(false)) => return None,
2759+
None => self.rust_info.is_managed_git_subrepository(),
2760+
Some(StringOrBool::Bool(false)) => return None,
27602761
Some(StringOrBool::Bool(true)) => false,
2761-
Some(StringOrBool::String(s)) if s == "if-unchanged" => true,
2762+
Some(StringOrBool::String(s)) if s == "if-unchanged" => {
2763+
if !self.rust_info.is_managed_git_subrepository() {
2764+
println!(
2765+
"ERROR: `download-rustc=if-unchanged` is only compatible with Git managed sources."
2766+
);
2767+
crate::exit!(1);
2768+
}
2769+
2770+
true
2771+
}
27622772
Some(StringOrBool::String(other)) => {
27632773
panic!("unrecognized option for download-rustc: {other}")
27642774
}
@@ -2785,7 +2795,7 @@ impl Config {
27852795
}
27862796
println!("ERROR: could not find commit hash for downloading rustc");
27872797
println!("HELP: maybe your repository history is too shallow?");
2788-
println!("HELP: consider disabling `download-rustc`");
2798+
println!("HELP: consider setting `rust.download-rustc=false` in config.toml");
27892799
println!("HELP: or fetch enough history to include one upstream commit");
27902800
crate::exit!(1);
27912801
}

0 commit comments

Comments
 (0)