One interesting reslult of the last round of tech empower benchmarks is that one of the top slots is occupied by may-minihttp:
may is a stackful coroutine library -- it uses asm tricks to implement cooperative scheduling of green threads.
However, may is not safe to use -- spawning a coroutine is an
unsafe operation, because acessing TLS from a couroutine can lead to undefined behavior (and not just errors): may/coroutine_impl.rs at 5e1fe6392360267c092e7c5879ab96e5d68fc28d · Xudong-Huang/may · GitHub.
I am wondering, do we have some kind of a story to make this safe? Implementing green-threads "in userland" by manually switching stacks is a well-known systems programming trick. Can Rust express it in a sound way?