Skip to content

Commit a980cd4

Browse files
committed
Auto merge of #143807 - rperier:rustc_llvm_werror, r=cuviper
Pass -Werror when building the LLVM wrapper cc #109712
2 parents 2fd855f + d37fae3 commit a980cd4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler/rustc_llvm/build.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@ fn main() {
171171
let cxxflags = output(&mut cmd);
172172
let mut cfg = cc::Build::new();
173173
cfg.warnings(false);
174+
175+
// Prevent critical warnings when we're compiling from rust-lang/rust CI,
176+
// except on MSVC, as the compiler throws warnings that are only reported
177+
// for this platform. See https://github.com/rust-lang/rust/pull/145031#issuecomment-3162677202
178+
// FIXME(llvm22): It looks like the specific problem code has been removed
179+
// in https://github.com/llvm/llvm-project/commit/e8fc808bf8e78a3c80d1f8e293a92677b92366dd,
180+
// retry msvc once we bump our LLVM version.
181+
if std::env::var_os("CI").is_some() && !target.contains("msvc") {
182+
cfg.warnings_into_errors(true);
183+
}
174184
for flag in cxxflags.split_whitespace() {
175185
// Ignore flags like `-m64` when we're doing a cross build
176186
if is_crossed && flag.starts_with("-m") {

0 commit comments

Comments
 (0)