From 8271991bd0ba3176edd81b20ad74f5f702b07ac0 Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Fri, 11 Jul 2025 18:28:45 +0200 Subject: [PATCH] Pass -Werror when building the LLVM wrapper Enabling warning_into_errors() only whether it's in rust-lang/rust CI, so deprecated uses of LLVM methods can be treated as errors. --- compiler/rustc_llvm/build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 9a6549379d39c..f9490810b4c34 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -167,6 +167,11 @@ fn main() { let cxxflags = output(&mut cmd); let mut cfg = cc::Build::new(); cfg.warnings(false); + + // Prevent critical warnings when we're compiling from rust-lang/rust CI + if std::env::var_os("CI").is_some() { + cfg.warnings_into_errors(true); + } for flag in cxxflags.split_whitespace() { // Ignore flags like `-m64` when we're doing a cross build if is_crossed && flag.starts_with("-m") {