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:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user