From 0d38efa902f14b1dc23a40243b4796ec9d534a1c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 15 Nov 2026 09:14:18 -0800 Subject: [PATCH 1/2] fix(moq-sock,moq-relay): macOS and Windows compile without warnings again Program's fields and the test's V1/V2 are read only by Linux's steering filter, the off-Linux handoff refusal no longer leaves the Linux checks unreachable, and the transcode bench imports Duration only where it uses it. Co-Authored-By: Claude Opus 5.5 --- rs/moq-relay/src/config.rs | 3 +-- rs/moq-sock/src/shard.rs | 9 +++++++++ rs/moq-transcode/benches/ladder.rs | 5 ++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/rs/moq-relay/src/config.rs b/rs/moq-relay/src/config.rs index 23f496df01b..b4bbdcbcbf6 100644 --- a/rs/moq-relay/src/config.rs +++ b/rs/moq-relay/src/config.rs @@ -390,8 +390,7 @@ impl Config { if self.handoff.socket.is_none() { return Ok(()); } - #[cfg(not(target_os = "linux"))] - anyhow::bail!("handoff.socket is Linux-only"); + anyhow::ensure!(cfg!(target_os = "linux"), "handoff.socket is Linux-only"); // Static and API peers share one dial socket on a fixed port, bound at startup and // not handed on: a successor could not bind it beside the relay it replaces. anyhow::ensure!( diff --git a/rs/moq-sock/src/shard.rs b/rs/moq-sock/src/shard.rs index 390050b222d..e2610bcd761 100644 --- a/rs/moq-sock/src/shard.rs +++ b/rs/moq-sock/src/shard.rs @@ -745,6 +745,13 @@ pub const MAX_SHARDS: u16 = 256; /// What the steering filter computes for one group. #[derive(Clone, Copy, Debug)] +#[cfg_attr( + not(target_os = "linux"), + expect( + dead_code, + reason = "only Linux's filter reads it, and elsewhere a group never binds" + ) +)] struct Program { /// Members per generation. count: u16, @@ -1060,7 +1067,9 @@ mod tests { packet } + #[cfg(target_os = "linux")] const V1: [u8; 4] = [0, 0, 0, 1]; + #[cfg(target_os = "linux")] const V2: [u8; 4] = [0x6b, 0x33, 0x43, 0xcf]; /// Every packet a client sends with a connection ID the server chose. diff --git a/rs/moq-transcode/benches/ladder.rs b/rs/moq-transcode/benches/ladder.rs index 25bd340297b..6937874d4f7 100644 --- a/rs/moq-transcode/benches/ladder.rs +++ b/rs/moq-transcode/benches/ladder.rs @@ -15,7 +15,6 @@ //! Run with `cargo bench -p moq-transcode --bench ladder`. use std::sync::Arc; -use std::time::Duration; use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main}; use moq_transcode::{Config, Ladder, Rung}; @@ -98,12 +97,12 @@ async fn fanout(sinks: &mut [(moq_video::Size, moq_video::encode::Sink)], frame: /// CPU time the calling thread has used, which on a current-thread runtime is the worker's. #[cfg(unix)] -fn thread_cpu() -> Duration { +fn thread_cpu() -> std::time::Duration { let mut time = libc::timespec { tv_sec: 0, tv_nsec: 0 }; // SAFETY: `time` is a valid, initialized output pointer for this supported clock. let result = unsafe { libc::clock_gettime(libc::CLOCK_THREAD_CPUTIME_ID, &mut time) }; assert_eq!(result, 0, "thread CPU clock: {}", std::io::Error::last_os_error()); - Duration::new( + std::time::Duration::new( u64::try_from(time.tv_sec).unwrap(), u32::try_from(time.tv_nsec).unwrap(), ) From fead3f6ab5a44ba7e71ff25f95db55765dbd8e99 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 15 Nov 2026 09:49:14 -0800 Subject: [PATCH 2/2] fix(moq-relay): handoff's Linux-only items compile off Linux without reasonless allows Windows' clippy-driver test step denies allow attributes without a reason. The supervise flag and relay_args exist only where Linux or the test reads them; Events keeps an expect with its reason. Co-Authored-By: Claude Opus 5.5 --- rs/moq-relay/src/handoff.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rs/moq-relay/src/handoff.rs b/rs/moq-relay/src/handoff.rs index 059e0c8ab48..381ed771b90 100644 --- a/rs/moq-relay/src/handoff.rs +++ b/rs/moq-relay/src/handoff.rs @@ -74,12 +74,12 @@ pub struct Config { } /// The flag that runs a stand-in, which its relay must not see again. -#[cfg_attr(not(target_os = "linux"), allow(dead_code))] +#[cfg(any(target_os = "linux", test))] const SUPERVISE_FLAG: &str = "--handoff-supervise"; /// The arguments a stand-in starts its relay with: its own, but for the flag that /// made it a stand-in. -#[cfg_attr(not(target_os = "linux"), allow(dead_code))] +#[cfg(any(target_os = "linux", test))] fn relay_args(args: impl IntoIterator) -> Vec { let mut positional = false; args.into_iter() @@ -177,7 +177,10 @@ struct Group { } /// What a serving [`Handoff`] tells the rest of the relay. -#[cfg_attr(not(target_os = "linux"), allow(dead_code))] +#[cfg_attr( + not(target_os = "linux"), + expect(dead_code, reason = "off Linux no Handoff exists to read them") +)] pub(crate) struct Events { /// Set once a successor took over: stop accepting and drain. pub handed: tokio::sync::watch::Sender,