From e755d71855aa455cdc72e210e8caae2a63e3379e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Mon, 13 Oct 2025 09:29:21 +0200 Subject: [PATCH] Add a warning when running tests with the GCC backend and debug assertions are enabled --- src/bootstrap/src/core/build_steps/test.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 36cd4b24c5911..5fbedb045e409 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1942,6 +1942,17 @@ HELP: You can add it into `bootstrap.toml` in `rust.codegen-backends = [{name:?} ); crate::exit!(1); } + + if let CodegenBackendKind::Gcc = codegen_backend + && builder.config.rustc_debug_assertions + { + eprintln!( + r#"WARNING: Running tests with the GCC codegen backend while rustc debug assertions are enabled. This might lead to test failures. +Please disable assertions with `rust.debug-assertions = false`. + "# + ); + } + // Tells compiletest that we want to use this codegen in particular and to override // the default one. cmd.arg("--override-codegen-backend").arg(codegen_backend.name());