Skip to content

Commit 0eb19dc

Browse files
authored
Rollup merge of rust-lang#67622 - gilescope:async-keyword-doc, r=Centril
Some keyword documentation. I thought about going into detail, but I'd much rather route them to the async book asap.
2 parents 97a7b03 + bc1b2d5 commit 0eb19dc

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/libstd/keyword_docs.rs

+23-4
Original file line numberDiff line numberDiff line change
@@ -1149,20 +1149,39 @@ mod where_keyword {}
11491149
//
11501150
/// Return a [`Future`] instead of blocking the current thread.
11511151
///
1152-
/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
1152+
/// Use `async` in front of `fn`, `closure`, or a `block` to turn the marked code into a `Future`.
1153+
/// As such the code will not be run immediately, but will only be evaluated when the returned
1154+
/// future is `.await`ed.
1155+
///
1156+
/// We have written an [async book] detailing async/await and trade-offs compared to using threads.
1157+
///
1158+
/// ## Editions
1159+
///
1160+
/// `async` is a keyword from the 2018 edition onwards.
1161+
///
1162+
/// It is available for use in stable rust from version 1.39 onwards.
11531163
///
11541164
/// [`Future`]: ./future/trait.Future.html
1155-
/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
1165+
/// [async book]: https://rust-lang.github.io/async-book/
11561166
mod async_keyword {}
11571167

11581168
#[doc(keyword = "await")]
11591169
//
11601170
/// Suspend execution until the result of a [`Future`] is ready.
11611171
///
1162-
/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
1172+
/// `.await`ing a future will suspend the current function's execution until the `executor`
1173+
/// has run the future to completion.
1174+
///
1175+
/// Read the [async book] for details on how async/await and executors work.
1176+
///
1177+
/// ## Editions
1178+
///
1179+
/// `await` is a keyword from the 2018 edition onwards.
1180+
///
1181+
/// It is available for use in stable rust from version 1.39 onwards.
11631182
///
11641183
/// [`Future`]: ./future/trait.Future.html
1165-
/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
1184+
/// [async book]: https://rust-lang.github.io/async-book/
11661185
mod await_keyword {}
11671186

11681187
#[doc(keyword = "dyn")]

0 commit comments

Comments
 (0)