From e2fa781cb2c092de179b8c8d4a2e46f37e725d27 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 10 Mar 2026 17:11:22 +0100 Subject: [PATCH] fix(ml-dqn): make is_gpu_prioritized() available without cuda feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the cfg gate inside the method body instead of gating the entire function. Without cuda, the GpuPrioritized variant doesn't exist so matches! returns false — no need for separate cfg blocks at call sites. Fixes compile-services CI failure (services build without --features cuda). Co-Authored-By: Claude Opus 4.6 --- crates/ml-dqn/src/replay_buffer_type.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/ml-dqn/src/replay_buffer_type.rs b/crates/ml-dqn/src/replay_buffer_type.rs index 5dd62e5bc..add91833f 100644 --- a/crates/ml-dqn/src/replay_buffer_type.rs +++ b/crates/ml-dqn/src/replay_buffer_type.rs @@ -490,10 +490,13 @@ impl ReplayBufferType { matches!(self, Self::Prioritized(_)) } - /// Check if using GPU-resident prioritized replay - #[cfg(feature = "cuda")] + /// Check if using GPU-resident prioritized replay. + /// Returns false when compiled without `cuda` feature (variant doesn't exist). pub const fn is_gpu_prioritized(&self) -> bool { - matches!(self, Self::GpuPrioritized(_)) + #[cfg(feature = "cuda")] + { matches!(self, Self::GpuPrioritized(_)) } + #[cfg(not(feature = "cuda"))] + { false } } /// Adaptive buffer sizing based on epsilon decay