@@ -19,7 +19,9 @@ use tokio::sync::oneshot;
1919/// required for self-referential `async` blocks.
2020/// - `Box`: Allocates the `Future` on the heap.
2121/// - `dyn Future`: Type erasure - hides the specific concrete `Future` type.
22- /// - `+ Send`: Ensures the `Future` can be safely sent across threads.
22+ /// - `+ Send`: Ensures the `Future` can be safely sent across threads and required
23+ /// by the tower-lsp-server LSP server trait bounds, even in our single-threaded
24+ /// runtime.
2325type TaskFuture = Pin < Box < dyn Future < Output = Result < ( ) > > + Send > > ;
2426
2527/// Type alias for a type-erased, heap-allocated, Send-able closure that,
@@ -34,7 +36,8 @@ type TaskFuture = Pin<Box<dyn Future<Output = Result<()>> + Send>>;
3436/// arguments.
3537/// - `-> TaskFuture`: Specifies that calling the closure produces the type-erased future.
3638/// - `+ Send + 'static`: Ensures the closure itself can be safely sent across
37- /// threads and has a static lifetime (doesn't borrow short-lived data).
39+ /// threads and has a static lifetime (doesn't borrow short-lived data). Required
40+ /// for compatibility with our async runtime and LSP traits.
3841type TaskClosure = Box < dyn FnOnce ( ) -> TaskFuture + Send + ' static > ;
3942
4043/// A simple asynchronous task queue for sequential execution.
@@ -43,8 +46,9 @@ type TaskClosure = Box<dyn FnOnce() -> TaskFuture + Send + 'static>;
4346/// to a dedicated worker task which executes them one at a time in the order
4447/// they were received. This ensures sequential processing of background tasks.
4548///
46- /// The queue is cloneable (`Arc`-based internally), allowing multiple producers
47- /// to submit tasks concurrently.
49+ /// The queue runs within our single-threaded runtime but maintains compatibility
50+ /// with the Send+Sync requirements of the LSP. This provides the benefits of
51+ /// simpler execution while maintaining the required trait bounds.
4852///
4953/// Shutdown is handled gracefully when the last `Queue` instance is dropped.
5054#[ derive( Clone ) ]
0 commit comments