diff --git a/tokio/src/task/builder.rs b/tokio/src/task/builder.rs index dd5d4845692..a0947b50108 100644 --- a/tokio/src/task/builder.rs +++ b/tokio/src/task/builder.rs @@ -48,7 +48,7 @@ use std::{future::Future, io}; /// .spawn(async move { /// // Process each socket concurrently. /// process(socket).await -/// }); +/// })?; /// } /// } /// ``` diff --git a/tokio/src/task/join_set.rs b/tokio/src/task/join_set.rs index 858234cf6a2..79e54cc2e64 100644 --- a/tokio/src/task/join_set.rs +++ b/tokio/src/task/join_set.rs @@ -101,13 +101,13 @@ impl JoinSet { /// use tokio::task::JoinSet; /// /// #[tokio::main] - /// async fn main() { + /// async fn main() -> io::Result<()> { /// let mut set = JoinSet::new(); /// /// // Use the builder to configure a task's name before spawning it. /// set.build_task() /// .name("my_task") - /// .spawn(async { /* ... */ }); + /// .spawn(async { /* ... */ })?; /// } /// ``` #[cfg(all(tokio_unstable, feature = "tracing"))]