Skip to content

Commit 7849e37

Browse files
committed
fix(palette_codec): gate bytemuck_cast_u64_to_u8 to x86_64 (dead on aarch64 under -D warnings)
The new `neon_simd` CI job builds ndarray for aarch64 with the workflow-global `RUSTFLAGS: -D warnings`. `bytemuck_cast_u64_to_u8`'s only caller is `unpack_4bit_avx2` (`#[cfg(target_arch = "x86_64")]`), so on aarch64 the function is dead code → `-D dead-code` build error. Gate the function with the same `#[cfg(target_arch = "x86_64")]` as its caller. x86_64 is unchanged (both compile and the function is used); reproduced green locally with `RUSTFLAGS="-D warnings" cargo build --target aarch64-unknown-linux-gnu`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K6pT32kk6pnuAAqR3JiYqu
1 parent 37306f2 commit 7849e37

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/palette_codec.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,10 @@ unsafe fn unpack_4bit_avx2(packed: &[u64], count: usize) -> Vec<u8> {
399399
}
400400

401401
/// Reinterpret &[u64] as &[u8] (little-endian safe).
402+
// Only reachable from the x86_64 AVX2 unpack path (`unpack_4bit_avx2`); gated to
403+
// match so it isn't dead code on non-x86 targets under `-D warnings` (the
404+
// aarch64 neon-parity + cross builds compile this file).
405+
#[cfg(target_arch = "x86_64")]
402406
fn bytemuck_cast_u64_to_u8(words: &[u64]) -> &[u8] {
403407
// SAFETY: u64 and u8 have compatible layouts on little-endian
404408
unsafe { core::slice::from_raw_parts(words.as_ptr() as *const u8, words.len() * 8) }

0 commit comments

Comments
 (0)