about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-18 04:27:54 +0200
committerGitHub <noreply@github.com>2025-07-18 04:27:54 +0200
commit3023a287fa45c778087f705573f042d80cb1fc52 (patch)
tree8872d2aa2dc18cde351de4aa611432dae1c711cb
parent19ed2f10be0a5c8175f8e5bb44935ce5f302aa9f (diff)
parent0e423f441ade436bd732ececd3dd6c79885dd07c (diff)
downloadrust-3023a287fa45c778087f705573f042d80cb1fc52.tar.gz
rust-3023a287fa45c778087f705573f042d80cb1fc52.zip
Rollup merge of #144010 - xdoardo:bootstrap-warning-optimize-false, r=clubby789
Boostrap: add warning on `optimize = false`

I recently came across a bug that can be traced back to the use of `optimize = false` in `bootstrap.toml` in combination with other settings. Following [this](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Missing.20box-related.20symbols.20with.20panic.20.3D.20'abort'/with/528992909) conversation, this PR adds a warning from `bootstrap` when `optimize = false` is used.

I notice that in the same file I edited there are two different styles for warnings (`WARN`, `Warning`). I used `WARNING` because, by happenstance, when testing I got a `WARNING` that I didn't set a change id: let me know if I can unify the styles in the file I edited.
-rw-r--r--src/bootstrap/src/core/config/toml/rust.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs
index 307aa52294b..71fab0e6ae6 100644
--- a/src/bootstrap/src/core/config/toml/rust.rs
+++ b/src/bootstrap/src/core/config/toml/rust.rs
@@ -531,6 +531,14 @@ impl Config {
             lld_enabled = lld_enabled_toml;
             std_features = std_features_toml;
 
+            if optimize_toml.as_ref().is_some_and(|v| matches!(v, RustOptimize::Bool(false))) {
+                eprintln!(
+                    "WARNING: setting `optimize` to `false` is known to cause errors and \
+                    should be considered unsupported. Refer to `bootstrap.example.toml` \
+                    for more details."
+                );
+            }
+
             optimize = optimize_toml;
             self.rust_new_symbol_mangling = new_symbol_mangling;
             set(&mut self.rust_optimize_tests, optimize_tests);