The v0.26.0 tag went red on Windows — a Linux-only reader tripped dead_code and the host lib would not compile #134

Merged
enricobuehler merged 1 commits from worktree-pyrowave-wire-dead-code into main 2026-08-08 23:44:48 +00:00
Owner

The v0.26.0 tag failed windows-host at the clippy step, after a clean 4m25s release build:

error: function `wire_sequence` is never used
  --> crates\pf-encode\src\enc\pyrowave_wire.rs:68:15
   = note: `-D dead-code` implied by `-D warnings`
error: could not compile `pf-encode` (lib) due to 1 previous error

Why it is dead on Windows and not on Linux

pyrowave_wire is cfg'd for linux or windows and it really is shared — packet_boundary and stamp_color_bits each have call sites on both backends:

symbol Linux Windows
packet_boundary enc/linux/pyrowave.rs:1937 enc/windows/pyrowave.rs:616
stamp_color_bits enc/linux/pyrowave.rs:1964 enc/windows/pyrowave.rs:644
wire_sequence enc/linux/pyrowave.rs:1972, 1978, 3164 none

Every wire_sequence call site is in enc/linux/pyrowave.rs, which is #[cfg(all(target_os = "linux", feature = "pyrowave"))]. Alternating encoder handles are a Linux-side concern (PW5); the Windows backend drives pyrowave's compat device with a single handle and never needs the counter. The module's own #[cfg(test)] block does not reference it either — checked — so on Windows the item has zero callers in every target, dead_code is factually correct, and it is only the -D warnings promotion that turns it into a hard compile failure.

It arrived with the PW5 work in this release, which is why no earlier tag hit it.

The fix

#[cfg_attr(not(target_os = "linux"), allow(dead_code))] on that one function.

Two deliberate choices:

  • Scoped to the item, not the file. A file-level allow would also cover packet_boundary, stamp_color_bits and block_count_32x32, which have real callers and should keep their dead-code coverage.
  • cfg_attr(not(linux)), not a bare allow. dead_code stays live on Linux — where the caller lives, and where this function quietly losing its last caller would be a genuine finding rather than noise. A bare allow would switch the lint off everywhere and hide exactly the case worth catching.

⚠ Verification, honestly

Not reproducible off a Windows box. Cross-compiling to x86_64-pc-windows-msvc from macOS dies in openh264-sys2's build script (clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc') long before anything reaches the lint stage. cargo fmt --all --check is clean; the mechanism is exact — one item, one cfg, zero callers behind it — but the windows-host and windows-msix legs are the actual proof, and they run on the re-pointed tag.

No behaviour change on any platform: this is a lint attribute plus eight lines of comment.

After this merges

v0.26.0 gets re-pointed onto the new main tip. The release object is keyed by tag name, so ensure_release reuses the same release id and the notes body already seeded survives.

The `v0.26.0` tag failed `windows-host` at the clippy step, **after a clean 4m25s release build**: ``` error: function `wire_sequence` is never used --> crates\pf-encode\src\enc\pyrowave_wire.rs:68:15 = note: `-D dead-code` implied by `-D warnings` error: could not compile `pf-encode` (lib) due to 1 previous error ``` ## Why it is dead on Windows and not on Linux `pyrowave_wire` is cfg'd for linux **or** windows and it really is shared — `packet_boundary` and `stamp_color_bits` each have call sites on **both** backends: | symbol | Linux | Windows | |---|---|---| | `packet_boundary` | `enc/linux/pyrowave.rs:1937` | `enc/windows/pyrowave.rs:616` | | `stamp_color_bits` | `enc/linux/pyrowave.rs:1964` | `enc/windows/pyrowave.rs:644` | | **`wire_sequence`** | `enc/linux/pyrowave.rs:1972, 1978, 3164` | **none** | Every `wire_sequence` call site is in `enc/linux/pyrowave.rs`, which is `#[cfg(all(target_os = "linux", feature = "pyrowave"))]`. Alternating encoder handles are a Linux-side concern (PW5); the Windows backend drives pyrowave's compat device with a single handle and never needs the counter. The module's own `#[cfg(test)]` block does not reference it either — checked — so on Windows the item has zero callers **in every target**, `dead_code` is factually correct, and it is only the `-D warnings` promotion that turns it into a hard compile failure. It arrived with the PW5 work in this release, which is why no earlier tag hit it. ## The fix `#[cfg_attr(not(target_os = "linux"), allow(dead_code))]` on that one function. Two deliberate choices: - **Scoped to the item, not the file.** A file-level allow would also cover `packet_boundary`, `stamp_color_bits` and `block_count_32x32`, which have real callers and should keep their dead-code coverage. - **`cfg_attr(not(linux))`, not a bare `allow`.** `dead_code` stays **live on Linux** — where the caller lives, and where this function quietly losing its last caller would be a genuine finding rather than noise. A bare `allow` would switch the lint off everywhere and hide exactly the case worth catching. ## ⚠ Verification, honestly **Not reproducible off a Windows box.** Cross-compiling to `x86_64-pc-windows-msvc` from macOS dies in `openh264-sys2`'s build script (`clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'`) long before anything reaches the lint stage. `cargo fmt --all --check` is clean; the mechanism is exact — one item, one cfg, zero callers behind it — but **the `windows-host` and `windows-msix` legs are the actual proof**, and they run on the re-pointed tag. No behaviour change on any platform: this is a lint attribute plus eight lines of comment. ## After this merges `v0.26.0` gets **re-pointed** onto the new main tip. The release object is keyed by tag *name*, so `ensure_release` reuses the same release id and the notes body already seeded survives.
enricobuehler added 1 commit 2026-08-08 23:44:29 +00:00
fix(pf-encode): the Windows host could not compile — a Linux-only reader tripped dead_code
apple / swift (pull_request) Successful in 1m35s
apple / screenshots (pull_request) Skipped
ci / web (pull_request) Successful in 1m24s
android / android (pull_request) Successful in 5m55s
ci / rust-arm64 (pull_request) Successful in 4m5s
ci / bun-nix (pull_request) Successful in 33s
ci / docs-site (pull_request) Successful in 1m32s
ci / rust (pull_request) Successful in 21m44s
2079411f4f
The v0.26.0 tag went red on windows-host at the clippy step, after a clean
build:

  error: function `wire_sequence` is never used
    --> crates\pf-encode\src\enc\pyrowave_wire.rs:68:15
     = note: `-D dead-code` implied by `-D warnings`

`pyrowave_wire` is cfg'd for linux OR windows and is genuinely shared —
`packet_boundary` and `stamp_color_bits` each have callers on both backends.
`wire_sequence` does not: every call site is in `enc/linux/pyrowave.rs`, which
is `#[cfg(all(target_os = "linux", feature = "pyrowave"))]`. Alternating
encoder handles are a Linux-side concern (PW5); the Windows backend drives
pyrowave's compat device with a single handle and never needs the counter. The
module's own `#[cfg(test)]` block does not reference it either, so on Windows
the item has zero callers in every target and dead_code is correct — it is the
`-D warnings` promotion to a hard error that stops the lib compiling.

Scoped to the one item rather than the file, and expressed as
`cfg_attr(not(target_os = "linux"), ...)` rather than a bare `allow`, so
dead_code stays LIVE on Linux — where the caller lives, and where this function
quietly losing its last caller would be a real finding rather than noise.

⚠ Not reproducible off a Windows box: cross-compiling to
x86_64-pc-windows-msvc from macOS dies in openh264-sys2's build script
(clang++ rejects `-fPIC` for that target) long before the lint stage. The
mechanism is nonetheless exact — one item, one cfg, zero callers behind it —
and the windows-host and windows-msix legs are the proof.

No behaviour change on any platform: this adds a lint attribute and eight
lines of comment.
enricobuehler merged commit 55f361cb92 into main 2026-08-08 23:44:48 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unom/punktfunk#134