Commit 59e56ce
committed
fix(ci): allow dead_code on Tier enums for non-x86_64 cross-builds
i686-unknown-linux-gnu cross-tests (which run under -D warnings) failed:
error: variants `Avx512` and `Avx2` are never constructed
--> src/backend/native.rs:17:5
= note: `-D dead-code` implied by `-D warnings`
Two `enum Tier { Avx512, Avx2, ..., Scalar }` definitions exist, one in
`src/backend/native.rs` and one in `src/simd.rs`. Both `detect_tier()`
blocks gate the AVX-detection paths behind `#[cfg(target_arch =
"x86_64")]`; the NEON-detection (simd.rs only) is gated behind
`#[cfg(target_arch = "aarch64")]`. On i686 / wasm32 / etc., none of
those gates match → only `Scalar` is ever constructed → dead-code
lint fires on the other variants.
Fix: `#[allow(dead_code)]` on both Tier enums. The variants ARE needed
on x86_64 and aarch64 builds (the cfg blocks produce them via runtime
feature detection); they just don't reach instantiation under the i686
target_arch.
The src/simd.rs fix is preemptive — only src/backend/native.rs was
flagged in the CI error, but src/simd.rs has 4 non-Scalar variants
(Avx512, Avx2, NeonDotProd, Neon) that would trigger the same lint
under -D warnings on i686. Both fixed in one commit.
Verification:
- `cargo clippy --no-deps` (default x86_64) → clean (the variants ARE
constructed via `is_x86_feature_detected!("avx512f")`)
- `RUSTFLAGS="-D dead_code" cargo check --lib --features ...` → clean1 parent 6245c00 commit 59e56ce
2 files changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
| |||
0 commit comments