Rollup merge of #146618 - GuillaumeGomez:backend-run-llvm-options, r=kobzol

Do not run ui test if options specific to LLVM are used when another codegen backend is used

Based on errors in https://github.com/rust-lang/rust/pull/146414, some tests with LLVM-specific options are run when another codegen is actually the one used.

This PR ignores these tests in such cases now to prevent this situation.

r? `@kobzol`
This commit is contained in:
Matthias Krüger 2025-09-16 20:42:24 +02:00 committed by GitHub
commit cf035527ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View file

@ -203,6 +203,10 @@ impl CodegenBackend {
Self::Llvm => "llvm",
}
}
pub fn is_llvm(self) -> bool {
matches!(self, Self::Llvm)
}
}
/// Configuration for `compiletest` *per invocation*.

View file

@ -81,8 +81,8 @@ pub(super) fn handle_needs(
},
Need {
name: "needs-enzyme",
condition: config.has_enzyme,
ignore_reason: "ignored when LLVM Enzyme is disabled",
condition: config.has_enzyme && config.default_codegen_backend.is_llvm(),
ignore_reason: "ignored when LLVM Enzyme is disabled or LLVM is not the default codegen backend",
},
Need {
name: "needs-run-enabled",
@ -161,8 +161,8 @@ pub(super) fn handle_needs(
},
Need {
name: "needs-llvm-zstd",
condition: cache.llvm_zstd,
ignore_reason: "ignored if LLVM wasn't build with zstd for ELF section compression",
condition: cache.llvm_zstd && config.default_codegen_backend.is_llvm(),
ignore_reason: "ignored if LLVM wasn't build with zstd for ELF section compression or LLVM is not the default codegen backend",
},
Need {
name: "needs-rustc-debug-assertions",
@ -279,7 +279,10 @@ pub(super) fn handle_needs(
// Handled elsewhere.
if name == "needs-llvm-components" {
return IgnoreDecision::Continue;
if config.default_codegen_backend.is_llvm() {
return IgnoreDecision::Continue;
}
return IgnoreDecision::Ignore { reason: "LLVM specific test".into() };
}
let mut found_valid = false;