">

use download-rustc="if-unchanged" as default whenever possible · rust-lang/rust@cce6f03 (original) (raw)

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -2756,9 +2756,19 @@ impl Config {
2756 2756
2757 2757 // If `download-rustc` is not set, default to rebuilding.
2758 2758 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,
2760 2761 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 +}
2762 2772 Some(StringOrBool::String(other)) => {
2763 2773 panic!("unrecognized option for download-rustc: {other}")
2764 2774 }
@@ -2785,7 +2795,7 @@ impl Config {
2785 2795 }
2786 2796 println!("ERROR: could not find commit hash for downloading rustc");
2787 2797 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");
2789 2799 println!("HELP: or fetch enough history to include one upstream commit");
2790 2800 crate::exit!(1);
2791 2801 }