---
# System prepended metadata

title: Rio Async Runtime

---

# Rio Async Runtime

### Current Problem

While implementing the the Agenda generator example, I receive the following error regarding the runtime implementation

```bash
➜  rio git:(macros/renaming) make
cargo fmt --all
cargo build
   Compiling rio_rt v0.1.0-alpha.1 (/home/vincent/Github/rio/rt)
   Compiling rio_triage_await v0.1.0 (/home/vincent/Github/rio/examples/rio_triage_await)
error: future cannot be shared between threads safely
  --> examples/rio_triage_await/src/main.rs:11:14
   |
11 |       block_on(async {
   |  ______________^
12 | |         build_request().await;
13 | |     });
   | |_____^ future created by async block is not `Sync`
   |
   = help: the trait `Sync` is not implemented for `(dyn Future<Output = Result<surf::Response, surf::Error>> + Send + 'static)`
note: future is not `Sync` as it awaits another future which is not `Sync`
  --> examples/rio_triage_await/src/main.rs:5:19
   |
5  |     let mut res = surf::get("https://api.github.com/octocat").await?;
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `RequestBuilder`, which is not `Sync`
note: required by a bound in `block_on`
  --> /home/vincent/Github/rio/rt/src/runitime.rs:77:59
   |
77 | pub fn block_on(future: impl Future<Output = ()> + Send + Sync + 'static) {
   |                                                           ^^^^ required by this bound in `block_on`

error: could not compile `rio_triage_await` due to previous error
make: *** [Makefile:7: default] Error 101

```

The code that generate this error is

```rust=
use rio_rt::runitime::{block_on, wait};
use surf;

async fn build_request() -> Result<(), surf::Error> {
    let mut res = surf::get("https://api.github.com/octocat").await?;
    println!("{:?}", res.body_string().await.unwrap());
    Ok(())
}

fn main() {
    block_on(async {
        build_request().await;
    });
    wait();
}
```

I use async-std and surf https://github.com/http-rs/surf and the code is implemented in the following branch https://github.com/vincenzopalazzo/rio/tree/macros/renaming