Skip to content

Commit

Permalink
Add troubleshooting section to hello-tokio
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka committed Nov 26, 2024
1 parent 08574b4 commit b36aeb3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions content/tokio/tutorial/hello-tokio.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ You can find the full code [here][full].

[full]: https://github.com/tokio-rs/website/blob/master/tutorial-code/hello-tokio/src/main.rs

# Troubleshooting

A common mistake is to forget to add `.await` on calls to asynchronous
functions. This is particularly easy to forget for functions where the return
value is not used by the application. The compiler warns you and teaches you how
to fix this error.

```plain
warning: unused implementer of `std::future::Future` that must be used
--> examples/hello-redis.rs:12:5
|
12 | client.set("hello", "world".into());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: futures do nothing unless you `.await` or poll them
= note: `#[warn(unused_must_use)]` on by default
```

# Breaking it down

Let's take some time to go over what we just did. There isn't much code, but a
Expand Down

0 comments on commit b36aeb3

Please sign in to comment.