@@ -1771,8 +1771,37 @@ impl Config {
17711771 std_features : std_features_toml,
17721772 } = rust;
17731773
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+ ) ;
17761805
17771806 debug = debug_toml;
17781807 rustc_debug_assertions = rustc_debug_assertions_toml;
@@ -2778,6 +2807,7 @@ impl Config {
27782807 fn download_ci_rustc_commit (
27792808 & self ,
27802809 download_rustc : Option < StringOrBool > ,
2810+ debug_assertions_requested : bool ,
27812811 llvm_assertions : bool ,
27822812 ) -> Option < String > {
27832813 if !is_download_ci_available ( & self . build . triple , llvm_assertions) {
@@ -2786,8 +2816,12 @@ impl Config {
27862816
27872817 // If `download-rustc` is not set, default to rebuilding.
27882818 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 ,
27912825 Some ( StringOrBool :: Bool ( true ) ) => false ,
27922826 Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => {
27932827 if !self . rust_info . is_managed_git_subrepository ( ) {
@@ -2845,6 +2879,14 @@ impl Config {
28452879 return None ;
28462880 }
28472881
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+
28482890 Some ( commit)
28492891 }
28502892
0 commit comments