Skip to content

Commit b36aeb3

Browse files
committed
Add troubleshooting section to hello-tokio
Fixes: tokio-rs#461
1 parent 08574b4 commit b36aeb3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: content/tokio/tutorial/hello-tokio.md

+18
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,24 @@ You can find the full code [here][full].
9696

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

99+
# Troubleshooting
100+
101+
A common mistake is to forget to add `.await` on calls to asynchronous
102+
functions. This is particularly easy to forget for functions where the return
103+
value is not used by the application. The compiler warns you and teaches you how
104+
to fix this error.
105+
106+
```plain
107+
warning: unused implementer of `std::future::Future` that must be used
108+
--> examples/hello-redis.rs:12:5
109+
|
110+
12 | client.set("hello", "world".into());
111+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112+
|
113+
= note: futures do nothing unless you `.await` or poll them
114+
= note: `#[warn(unused_must_use)]` on by default
115+
```
116+
99117
# Breaking it down
100118

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

0 commit comments

Comments
 (0)