@@ -1665,26 +1665,10 @@ impl Config {
1665
1665
let mut debuginfo_level_tools = None ;
1666
1666
let mut debuginfo_level_tests = None ;
1667
1667
let mut optimize = None ;
1668
+ let mut omit_git_hash = None ;
1668
1669
let mut lld_enabled = None ;
1669
1670
let mut std_features = None ;
1670
1671
1671
- let default = config. channel == "dev" ;
1672
- config. omit_git_hash = toml. rust . as_ref ( ) . and_then ( |r| r. omit_git_hash ) . unwrap_or ( default) ;
1673
-
1674
- config. rust_info = GitInfo :: new ( config. omit_git_hash , & config. src ) ;
1675
- config. cargo_info = GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/cargo" ) ) ;
1676
- config. rust_analyzer_info =
1677
- GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/rust-analyzer" ) ) ;
1678
- config. clippy_info =
1679
- GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/clippy" ) ) ;
1680
- config. miri_info = GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/miri" ) ) ;
1681
- config. rustfmt_info =
1682
- GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/rustfmt" ) ) ;
1683
- config. enzyme_info =
1684
- GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/enzyme" ) ) ;
1685
- config. in_tree_llvm_info = GitInfo :: new ( false , & config. src . join ( "src/llvm-project" ) ) ;
1686
- config. in_tree_gcc_info = GitInfo :: new ( false , & config. src . join ( "src/gcc" ) ) ;
1687
-
1688
1672
let mut is_user_configured_rust_channel = false ;
1689
1673
1690
1674
if let Some ( rust) = toml. rust {
@@ -1715,7 +1699,7 @@ impl Config {
1715
1699
verbose_tests,
1716
1700
optimize_tests,
1717
1701
codegen_tests,
1718
- omit_git_hash : _ , // already handled above
1702
+ omit_git_hash : omit_git_hash_toml ,
1719
1703
dist_src,
1720
1704
save_toolstates,
1721
1705
codegen_backends,
@@ -1766,6 +1750,7 @@ impl Config {
1766
1750
std_features = std_features_toml;
1767
1751
1768
1752
optimize = optimize_toml;
1753
+ omit_git_hash = omit_git_hash_toml;
1769
1754
config. rust_new_symbol_mangling = new_symbol_mangling;
1770
1755
set ( & mut config. rust_optimize_tests , optimize_tests) ;
1771
1756
set ( & mut config. codegen_tests , codegen_tests) ;
@@ -1841,6 +1826,24 @@ impl Config {
1841
1826
1842
1827
config. reproducible_artifacts = flags. reproducible_artifact ;
1843
1828
1829
+ // rust_info must be set before is_ci_llvm_available() is called.
1830
+ let default = config. channel == "dev" ;
1831
+ config. omit_git_hash = omit_git_hash. unwrap_or ( default) ;
1832
+ config. rust_info = GitInfo :: new ( config. omit_git_hash , & config. src ) ;
1833
+
1834
+ config. cargo_info = GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/cargo" ) ) ;
1835
+ config. rust_analyzer_info =
1836
+ GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/rust-analyzer" ) ) ;
1837
+ config. clippy_info =
1838
+ GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/clippy" ) ) ;
1839
+ config. miri_info = GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/miri" ) ) ;
1840
+ config. rustfmt_info =
1841
+ GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/rustfmt" ) ) ;
1842
+ config. enzyme_info =
1843
+ GitInfo :: new ( config. omit_git_hash , & config. src . join ( "src/tools/enzyme" ) ) ;
1844
+ config. in_tree_llvm_info = GitInfo :: new ( false , & config. src . join ( "src/llvm-project" ) ) ;
1845
+ config. in_tree_gcc_info = GitInfo :: new ( false , & config. src . join ( "src/gcc" ) ) ;
1846
+
1844
1847
// We need to override `rust.channel` if it's manually specified when using the CI rustc.
1845
1848
// This is because if the compiler uses a different channel than the one specified in config.toml,
1846
1849
// tests may fail due to using a different channel than the one used by the compiler during tests.
@@ -2757,19 +2760,9 @@ impl Config {
2757
2760
2758
2761
// If `download-rustc` is not set, default to rebuilding.
2759
2762
let if_unchanged = match download_rustc {
2760
- None => self . rust_info . is_managed_git_subrepository ( ) ,
2761
- Some ( StringOrBool :: Bool ( false ) ) => return None ,
2763
+ None | Some ( StringOrBool :: Bool ( false ) ) => return None ,
2762
2764
Some ( StringOrBool :: Bool ( true ) ) => false ,
2763
- Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => {
2764
- if !self . rust_info . is_managed_git_subrepository ( ) {
2765
- println ! (
2766
- "ERROR: `download-rustc=if-unchanged` is only compatible with Git managed sources."
2767
- ) ;
2768
- crate :: exit!( 1 ) ;
2769
- }
2770
-
2771
- true
2772
- }
2765
+ Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => true ,
2773
2766
Some ( StringOrBool :: String ( other) ) => {
2774
2767
panic ! ( "unrecognized option for download-rustc: {other}" )
2775
2768
}
@@ -2796,7 +2789,7 @@ impl Config {
2796
2789
}
2797
2790
println ! ( "ERROR: could not find commit hash for downloading rustc" ) ;
2798
2791
println ! ( "HELP: maybe your repository history is too shallow?" ) ;
2799
- println ! ( "HELP: consider setting `rust. download-rustc=false` in config.toml " ) ;
2792
+ println ! ( "HELP: consider disabling ` download-rustc` " ) ;
2800
2793
println ! ( "HELP: or fetch enough history to include one upstream commit" ) ;
2801
2794
crate :: exit!( 1 ) ;
2802
2795
}
0 commit comments