diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2024-11-17 22:36:18 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2024-11-23 23:47:19 +0800 |
| commit | 835f5f0f39a209a6b0cf8a360f9ddfb09d9a7bc6 (patch) | |
| tree | 109fd4508217f34468df25787d3d9b325ce7e454 /src/bootstrap | |
| parent | aafd56b87ac45454dd387f632af2eec48b004819 (diff) | |
| download | rust-835f5f0f39a209a6b0cf8a360f9ddfb09d9a7bc6.tar.gz rust-835f5f0f39a209a6b0cf8a360f9ddfb09d9a7bc6.zip | |
bootstrap: make `rust.debug-assertions = true` inhibit downloading CI rustc
Warn if `rust.download-rustc = true` is used with `rust.debug-assertions` as alt CI rustc is not currently built with debug assertions (not to be confused with LLVM assertions).
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index f35e8ec948b..9b2d49e7620 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1771,8 +1771,37 @@ impl Config { std_features: std_features_toml, } = rust; - config.download_rustc_commit = - config.download_ci_rustc_commit(download_rustc, config.llvm_assertions); + // FIXME(#133381): alt rustc builds currently do *not* have rustc debug assertions + // enabled. We should not download a CI alt rustc if we need rustc to have debug + // assertions (e.g. for crashes test suite). This can be changed once something like + // [Enable debug assertions on alt + // builds](https://github.com/rust-lang/rust/pull/131077) lands. + // + // Note that `rust.debug = true` currently implies `rust.debug-assertions = true`! + // + // This relies also on the fact that the global default for `download-rustc` will be + // `false` if it's not explicitly set. + let debug_assertions_requested = matches!(rustc_debug_assertions_toml, Some(true)) + || (matches!(debug_toml, Some(true)) + && !matches!(rustc_debug_assertions_toml, Some(false))); + + if debug_assertions_requested { + if let Some(ref opt) = download_rustc { + if opt.is_string_or_true() { + eprintln!( + "WARN: currently no CI rustc builds have rustc debug assertions \ + enabled. Please either set `rust.debug-assertions` to `false` if you \ + want to use download CI rustc or set `rust.download-rustc` to `false`." + ); + } + } + } + + config.download_rustc_commit = config.download_ci_rustc_commit( + download_rustc, + debug_assertions_requested, + config.llvm_assertions, + ); debug = debug_toml; rustc_debug_assertions = rustc_debug_assertions_toml; @@ -2778,6 +2807,7 @@ impl Config { fn download_ci_rustc_commit( &self, download_rustc: Option<StringOrBool>, + debug_assertions_requested: bool, llvm_assertions: bool, ) -> Option<String> { if !is_download_ci_available(&self.build.triple, llvm_assertions) { @@ -2786,9 +2816,9 @@ impl Config { // If `download-rustc` is not set, default to rebuilding. let if_unchanged = match download_rustc { - // Globally default for `download-rustc` to `false`, because some contributors don't use + // Globally default `download-rustc` to `false`, because some contributors don't use // profiles for reasons such as: - // - They need to seemlessly switch between compiler/library work. + // - They need to seamlessly switch between compiler/library work. // - They don't want to use compiler profile because they need to override too many // things and it's easier to not use a profile. None | Some(StringOrBool::Bool(false)) => return None, @@ -2849,6 +2879,14 @@ impl Config { return None; } + if debug_assertions_requested { + eprintln!( + "WARN: `rust.debug-assertions = true` will prevent downloading CI rustc as alt CI \ + rustc is not currently built with debug assertions." + ); + return None; + } + Some(commit) } |
