@@ -1771,8 +1771,37 @@ impl Config {
1771
1771
std_features : std_features_toml,
1772
1772
} = rust;
1773
1773
1774
- config. download_rustc_commit =
1775
- config. download_ci_rustc_commit ( download_rustc, config. llvm_assertions ) ;
1774
+ // FIXME(#133381): alt rustc builds currently do *not* have rustc debug assertions
1775
+ // enabled. We should not download a CI alt rustc if we need rustc to have debug
1776
+ // assertions (e.g. for crashes test suite). This can be changed once something like
1777
+ // [Enable debug assertions on alt
1778
+ // builds](https://github.com/rust-lang/rust/pull/131077) lands.
1779
+ //
1780
+ // Note that `rust.debug = true` currently implies `rust.debug-assertions = true`!
1781
+ //
1782
+ // This relies also on the fact that the global default for `download-rustc` will be
1783
+ // `false` if it's not explicitly set.
1784
+ let debug_assertions_requested = matches ! ( rustc_debug_assertions_toml, Some ( true ) )
1785
+ || ( matches ! ( debug_toml, Some ( true ) )
1786
+ && !matches ! ( rustc_debug_assertions_toml, Some ( false ) ) ) ;
1787
+
1788
+ if debug_assertions_requested {
1789
+ if let Some ( ref opt) = download_rustc {
1790
+ if opt. is_string_or_true ( ) {
1791
+ eprintln ! (
1792
+ "WARN: currently no CI rustc builds have rustc debug assertions \
1793
+ enabled. Please either set `rust.debug-assertions` to `false` if you \
1794
+ want to use download CI rustc or set `rust.download-rustc` to `false`."
1795
+ ) ;
1796
+ }
1797
+ }
1798
+ }
1799
+
1800
+ config. download_rustc_commit = config. download_ci_rustc_commit (
1801
+ download_rustc,
1802
+ debug_assertions_requested,
1803
+ config. llvm_assertions ,
1804
+ ) ;
1776
1805
1777
1806
debug = debug_toml;
1778
1807
rustc_debug_assertions = rustc_debug_assertions_toml;
@@ -2778,6 +2807,7 @@ impl Config {
2778
2807
fn download_ci_rustc_commit (
2779
2808
& self ,
2780
2809
download_rustc : Option < StringOrBool > ,
2810
+ debug_assertions_requested : bool ,
2781
2811
llvm_assertions : bool ,
2782
2812
) -> Option < String > {
2783
2813
if !is_download_ci_available ( & self . build . triple , llvm_assertions) {
@@ -2786,8 +2816,12 @@ impl Config {
2786
2816
2787
2817
// If `download-rustc` is not set, default to rebuilding.
2788
2818
let if_unchanged = match download_rustc {
2789
- None => self . rust_info . is_managed_git_subrepository ( ) ,
2790
- Some ( StringOrBool :: Bool ( false ) ) => return None ,
2819
+ // Globally default `download-rustc` to `false`, because some contributors don't use
2820
+ // profiles for reasons such as:
2821
+ // - They need to seamlessly switch between compiler/library work.
2822
+ // - They don't want to use compiler profile because they need to override too many
2823
+ // things and it's easier to not use a profile.
2824
+ None | Some ( StringOrBool :: Bool ( false ) ) => return None ,
2791
2825
Some ( StringOrBool :: Bool ( true ) ) => false ,
2792
2826
Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => {
2793
2827
if !self . rust_info . is_managed_git_subrepository ( ) {
@@ -2845,6 +2879,14 @@ impl Config {
2845
2879
return None ;
2846
2880
}
2847
2881
2882
+ if debug_assertions_requested {
2883
+ eprintln ! (
2884
+ "WARN: `rust.debug-assertions = true` will prevent downloading CI rustc as alt CI \
2885
+ rustc is not currently built with debug assertions."
2886
+ ) ;
2887
+ return None ;
2888
+ }
2889
+
2848
2890
Some ( commit)
2849
2891
}
2850
2892
0 commit comments