From 88b942652c69c290656a33e0f3c9f9241e822ca4 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 17 Apr 2019 03:19:38 +0900 Subject: [PATCH] async-await: fix examples (#1050) * Fix crate path in `Cargo.toml` of examples * Add `edition2018` to examples in the documentation to make it compiled on Rust 2018 * Fix an example in the documentation --- tokio-async-await/examples/Cargo.toml | 4 ++-- tokio-async-await/src/io/mod.rs | 12 ++++++------ tokio-async-await/src/stream/mod.rs | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tokio-async-await/examples/Cargo.toml b/tokio-async-await/examples/Cargo.toml index 058ecd574..fce5140da 100644 --- a/tokio-async-await/examples/Cargo.toml +++ b/tokio-async-await/examples/Cargo.toml @@ -25,14 +25,14 @@ name = "hyper" path = "src/hyper.rs" [dependencies] -tokio = { version = "0.1.0", path = "../..", features = ["async-await-preview"] } +tokio = { version = "0.1.18", features = ["async-await-preview"] } futures = "0.1.23" bytes = "0.4.9" hyper = "0.12.8" # Avoid using crates.io for Tokio dependencies [patch.crates-io] -tokio = { path = "../.." } +tokio = { path = "../../tokio" } tokio-async-await = { path = "../" } tokio-codec = { path = "../../tokio-codec" } tokio-current-thread = { path = "../../tokio-current-thread" } diff --git a/tokio-async-await/src/io/mod.rs b/tokio-async-await/src/io/mod.rs index f9605f184..6541bff47 100644 --- a/tokio-async-await/src/io/mod.rs +++ b/tokio-async-await/src/io/mod.rs @@ -24,7 +24,7 @@ pub trait AsyncReadExt: AsyncRead { /// /// # Examples /// - /// ``` + /// ```edition2018 /// #![feature(async_await, await_macro, futures_api)] /// tokio::run_async(async { /// // The extension trait can also be imported with @@ -58,7 +58,7 @@ pub trait AsyncReadExt: AsyncRead { /// /// # Examples /// - /// ``` + /// ```edition2018 /// #![feature(async_await, await_macro, futures_api)] /// tokio::run_async(async { /// // The extension trait can also be imported with @@ -77,7 +77,7 @@ pub trait AsyncReadExt: AsyncRead { /// /// ## EOF is hit before `buf` is filled /// - /// ``` + /// ```edition2018 /// #![feature(async_await, await_macro, futures_api)] /// tokio::run_async(async { /// // The extension trait can also be imported with @@ -109,7 +109,7 @@ pub trait AsyncWriteExt: AsyncWrite { /// /// # Examples /// - /// ``` + /// ```edition2018 /// #![feature(async_await, await_macro, futures_api)] /// tokio::run_async(async { /// // The extension trait can also be imported with @@ -138,7 +138,7 @@ pub trait AsyncWriteExt: AsyncWrite { /// /// # Examples /// - /// ``` + /// ```edition2018 /// #![feature(async_await, await_macro, futures_api)] /// tokio::run_async(async { /// // The extension trait can also be imported with @@ -162,7 +162,7 @@ pub trait AsyncWriteExt: AsyncWrite { /// /// # Examples /// - /// ``` + /// ```edition2018 /// #![feature(async_await, await_macro, futures_api)] /// tokio::run_async(async { /// // The extension trait can also be imported with diff --git a/tokio-async-await/src/stream/mod.rs b/tokio-async-await/src/stream/mod.rs index a5a0c2d2f..4ab0c10b5 100644 --- a/tokio-async-await/src/stream/mod.rs +++ b/tokio-async-await/src/stream/mod.rs @@ -12,12 +12,12 @@ pub trait StreamExt: Stream { /// /// # Examples /// - /// ``` - /// #![feature(await_macro, async_await)] + /// ```edition2018 + /// #![feature(await_macro, async_await, futures_api)] /// tokio::run_async(async { /// // The extension trait can also be imported with /// // `use tokio::prelude::*`. - /// use tokio::prelude::{stream, StreamExt}; + /// use tokio::prelude::{stream, StreamAsyncExt}; /// /// let mut stream = stream::iter_ok::<_, ()>(1..3); ///