organize and extend forbidden target feature tests by RalfJung · Pull Request #140395 · rust-lang/rust (original) (raw)

So somehow on CI we get a bunch of extra warnings:

2025-04-28T14:35:22.9208959Z '+div32' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9209370Z '+div32' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9209778Z '+lam-bh' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9210178Z '+lam-bh' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9210688Z '+lamcas' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9211099Z '+lamcas' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9211515Z '+ld-seq-sa' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9211932Z '+ld-seq-sa' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9212335Z '+scq' is not a recognized feature for this target (ignoring feature)
2025-04-28T14:35:22.9212721Z '+scq' is not a recognized feature for this target (ignoring feature)

I don't get those when running the test locally. Is that an LLVM version thing? Does loongarch64-unknown-none not work on older LLVM versions (not without a bunch of warnings, anyway)? How would one write a test for that target then...? And what even enables those target features?!?

Thank you for everything you've done.

IIRC, when the LLVM backend doesn't support target features listed in compiler/rustc_target/src/target_features.rs, the rustc throws these kinds of warnings. For LoongArch, features like div32 were introduced starting from LLVM 20, so they are not supported in LLVM 19, which is expected behavior.

Would it be possible to add a min-llvm-version to the test cases? This would help to handle the differences between LLVM version.

diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs index 02841b6690a..5b0d7b7b252 100644 --- a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs @@ -12,6 +12,7 @@ //@[riscv] needs-llvm-components: riscv //@[loongarch] compile-flags: --target=loongarch64-unknown-none -Ctarget-feature=-d //@[loongarch] needs-llvm-components: loongarch +//@[loongarch] min-llvm-version: 20 // For now this is just a warning. //@ build-pass

It would also be useful for the warning: Hard-float 'd' ABI can't be used ... for RISC-V.