Skip to content

Commit 8eb7ecb

Browse files
authored
Rollup merge of rust-lang#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.
2 parents b4eb9da + 0e423f4 commit 8eb7ecb

File tree

1 file changed

+8
-0
lines changed
  • src/bootstrap/src/core/config/toml

1 file changed

+8
-0
lines changed

src/bootstrap/src/core/config/toml/rust.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,14 @@ impl Config {
541541
lld_enabled = lld_enabled_toml;
542542
std_features = std_features_toml;
543543

544+
if optimize_toml.as_ref().is_some_and(|v| matches!(v, RustOptimize::Bool(false))) {
545+
eprintln!(
546+
"WARNING: setting `optimize` to `false` is known to cause errors and \
547+
should be considered unsupported. Refer to `bootstrap.example.toml` \
548+
for more details."
549+
);
550+
}
551+
544552
optimize = optimize_toml;
545553
self.rust_new_symbol_mangling = new_symbol_mangling;
546554
set(&mut self.rust_optimize_tests, optimize_tests);

0 commit comments

Comments
 (0)