Make `FutureSpawner` only require `Send + Sync` in `std` builds
What changed, and why it matters
This is a small Rust code cleanup change. It relaxes the compiler requirements on a trait called FutureSpawner so that it only demands thread-safety guarantees in standard (std) builds, matching the requirements already placed on the spawned futures themselves. There is no security-relevant behavior change.
No security action needed. Treat as normal code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit changes the FutureSpawner trait bounds from Send + Sync to MaybeSend + MaybeSync. In LDK’s async utilities, MaybeSend and MaybeSync are aliases that map to Send/Sync when the std feature is enabled and to nothing in no_std builds. This makes the trait bounds consistent with the bounds already applied to the futures being spawned. It is a compile-time ergonomics/conditional-compatibility fix, not a runtime change.
Changed components
lightning/src/util/native_async.rsInspect captured patch +3 / −2
diff --git a/lightning/src/util/native_async.rs b/lightning/src/util/native_async.rs
index 910e24a..61788e9 100644
--- a/lightning/src/util/native_async.rs
+++ b/lightning/src/util/native_async.rs
@@ -7,11 +7,12 @@
//! This module contains a few public utility which are used to run LDK in a native Rust async
//! environment.
-use crate::util::async_poll::MaybeSend;
+use crate::util::async_poll::{MaybeSend, MaybeSync};
+
use core::future::Future;
/// A generic trait which is able to spawn futures in the background.
-pub trait FutureSpawner: Send + Sync + 'static {
+pub trait FutureSpawner: MaybeSend + MaybeSync + 'static {
/// Spawns the given future as a background task.
///
/// This method MUST NOT block on the given future immediately.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.