> Alone from the compiler errors I have got doing that, I would assume that I would have been dealing with an unbearable amount of debugging of subtle memory issues.
Well, that's the thing about rust and async. It's far more restrictive (necessarily) than the bounds of safety. The hard problem rust runs into is that async functions can be executed outside of lexical and the lifetime tracking of the rust language. To be absolutely safe, rust ends up needing to assume that async can be executed with no respect to the surrounding lifetimes.
Rust would really benefit from something like structured concurrency in terms of the lifetimes of async functions.
> Well, that's the thing about rust and async. It's far more restrictive (necessarily) than the bounds of safety.
I obviously was not talking about things illegal in safe Rust, which are actually safe, e.g. you cannot send types which are not allowed to be moved across threads across threads in C++ either.
> To be absolutely safe, rust ends up needing to assume that async can be executed with no respect to the surrounding lifetimes.
seems to work with surrounding life times?
https://play.rust-lang.org/?version=stable&mode=debug&editio...