about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-07 23:29:58 +0000
committerbors <bors@rust-lang.org>2025-08-07 23:29:58 +0000
commita980cd4311ae4b5bf9099d418e32643d068f1344 (patch)
tree99cefa2c1322d9fc420b5513573c4ecbbcdfd3f8
parent2fd855fbfc8239285aa2d596f76a8cc75e17ce02 (diff)
parentd37fae309d66ea337269eeb46a990f0675ad1684 (diff)
downloadrust-a980cd4311ae4b5bf9099d418e32643d068f1344.tar.gz
rust-a980cd4311ae4b5bf9099d418e32643d068f1344.zip
Auto merge of #143807 - rperier:rustc_llvm_werror, r=cuviper
Pass -Werror when building the LLVM wrapper

cc rust-lang/rust#109712
-rw-r--r--compiler/rustc_llvm/build.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index 069b684ad09..6c740156c4d 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -171,6 +171,16 @@ 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,
+    // except on MSVC, as the compiler throws warnings that are only reported
+    // for this platform. See https://github.com/rust-lang/rust/pull/145031#issuecomment-3162677202
+    // FIXME(llvm22): It looks like the specific problem code has been removed
+    // in https://github.com/llvm/llvm-project/commit/e8fc808bf8e78a3c80d1f8e293a92677b92366dd,
+    // retry msvc once we bump our LLVM version.
+    if std::env::var_os("CI").is_some() && !target.contains("msvc") {
+        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") {