diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-16 20:42:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-16 20:42:24 +0200 |
| commit | cf035527acbd46608872add6158e1fc23049872d (patch) | |
| tree | d153edc338873136d6763dcd644e5e08b1ba5db0 /src | |
| parent | d1ed4f4238ce997e1ed2963d3edb9d3e730ef382 (diff) | |
| parent | a535042e80a38196a58c27a8c95552546affe5dc (diff) | |
| download | rust-cf035527acbd46608872add6158e1fc23049872d.tar.gz rust-cf035527acbd46608872add6158e1fc23049872d.zip | |
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`
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/compiletest/src/common.rs | 4 | ||||
| -rw-r--r-- | src/tools/compiletest/src/directives/needs.rs | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 143ccdcb9e5..6da102b1b5f 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -203,6 +203,10 @@ impl CodegenBackend { Self::Llvm => "llvm", } } + + pub fn is_llvm(self) -> bool { + matches!(self, Self::Llvm) + } } /// Configuration for `compiletest` *per invocation*. diff --git a/src/tools/compiletest/src/directives/needs.rs b/src/tools/compiletest/src/directives/needs.rs index ee46f4c70cb..3b7a9478717 100644 --- a/src/tools/compiletest/src/directives/needs.rs +++ b/src/tools/compiletest/src/directives/needs.rs @@ -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; |
