fix(ml): silence unsafe-code warnings on inference adapter Send/Sync impls

Add #[allow(unsafe_code)] on each unsafe impl Send/Sync for the four
inference adapters (DQN, PPO, TFT, Mamba2). The SAFETY comments explain
why these are sound — Mutex provides exclusive access.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-02-21 18:39:05 +01:00
parent 06329a3e96
commit 6cdffda475
4 changed files with 8 additions and 0 deletions

View File

@@ -26,7 +26,9 @@ pub struct DqnInferenceAdapter {
// SAFETY: DQN internally uses candle tensors which are Send+Sync.
// The Mutex provides exclusive access for inference calls.
#[allow(unsafe_code)]
unsafe impl Send for DqnInferenceAdapter {}
#[allow(unsafe_code)]
unsafe impl Sync for DqnInferenceAdapter {}
impl DqnInferenceAdapter {

View File

@@ -37,7 +37,9 @@ pub struct Mamba2InferenceAdapter {
// SAFETY: Mamba2SSM internally uses candle tensors which are Send+Sync.
// The Mutex provides exclusive access for inference calls and buffer mutation.
#[allow(unsafe_code)]
unsafe impl Send for Mamba2InferenceAdapter {}
#[allow(unsafe_code)]
unsafe impl Sync for Mamba2InferenceAdapter {}
impl Mamba2InferenceAdapter {

View File

@@ -28,7 +28,9 @@ pub struct PpoInferenceAdapter {
// SAFETY: PPO internally uses candle tensors which are Send+Sync.
// The Mutex provides exclusive access for inference calls.
#[allow(unsafe_code)]
unsafe impl Send for PpoInferenceAdapter {}
#[allow(unsafe_code)]
unsafe impl Sync for PpoInferenceAdapter {}
impl PpoInferenceAdapter {

View File

@@ -40,7 +40,9 @@ pub struct TftInferenceAdapter {
// SAFETY: TemporalFusionTransformer internally uses candle tensors which
// are Send+Sync. The Mutex provides exclusive access for inference calls.
#[allow(unsafe_code)]
unsafe impl Send for TftInferenceAdapter {}
#[allow(unsafe_code)]
unsafe impl Sync for TftInferenceAdapter {}
impl TftInferenceAdapter {