Why does Tokio's Runtime::block_on_all require a future with a 'static lifetime?

Viewed 1260

When dealing with Tokio and futures, the futures passed to the Tokio runtime must have a 'static lifetime most of the time. I understand that because the future might be moved to another thread where it can potentially outlive the place it was defined.

There is a method Runtime::block_on_all which guarantees that the future called will be terminated by the end of the call, it even returns the result of running this future.

In that case, I don't get (except for simplicity of the Tokio code) why the future must be 'static.

Can anyone shed some light on this?

1 Answers
Related