Why do Structs in tokio::spawn blocks need to be Send even when running in single thread mode?

⚓ Rust    📅 2025-11-12    👤 surdeus    👁️ 5      

surdeus

I am running my async program in single threaded mode:

#[tokio::main(flavor = "current_thread")]

But when doing,

let handle = tokio::spawn(async move {
     worker.run(controller);
});

The rust analyzer gives me an error "captured value is not Send".
While I understand the issue in multi-threaded runtime mode, why should this be the case in single-threaded mode?

2 posts - 2 participants

Read full topic

🏷️ Rust_feed