rustasync / runtime

Empowering everyone to build asynchronous software
https://docs.rs/runtime
Apache License 2.0
862 stars 28 forks source link

Support stable 1.36 #68

Closed Nemo157 closed 4 years ago

Nemo157 commented 5 years ago

I haven't verified fully whether this is possible, but it seems like adding support for fn main() -> impl Future (and similar for test functions) would allow using runtime on current stable.

Minimal example I would expect to work:

// runtime = { git = "https://github.com/rustasync/runtime" }
// futures-preview = "0.3.0-alpha.17"

use futures::future;

#[runtime::main]
fn main() -> impl Future<Output = ()> {
    println!("Hello, world!");
    future::ready(())
}
yoshuawuyts commented 5 years ago

@Nemo157 that would be very cool! I suspect with a bit of effort we could lift the return type, remove the arrow and insert it as Output = #ret.

That said, I do think we should keep the nightly constraint until async_await is on stable. Mostly because e.g. introducing fs free functions will likely have to be async fn. But those aren't here yet (: