-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async-await initial reference material #635
Conversation
So I get a bunch of errors from the examples like
Any tips on how to address these? :) |
(Especially the edition flag) |
I think you can follow these examples: https://github.com/rust-lang-nursery/reference/search?q=edition2018&unscoped_q=edition2018 |
Speaking of editions; I think it was not mentioned in the PR that the new stuff only works in edition 2018. Would be good to work that in (see https://github.com/rust-lang-nursery/reference/search?q=edition&unscoped_q=edition for examples). |
src/expressions/await-expr.md
Outdated
|
||
More specifically, a `f.await` expression has the following effect. | ||
|
||
1. evaluate `f` to a future `tmp` using the `IntoFuture:into_future` method; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. evaluate `f` to a future `tmp` using the `IntoFuture:into_future` method; | |
1. evaluate `f` to a future temporary variable `tmp` using the `IntoFuture:into_future` method; |
I don't like "future" there, but don't really see a better way to succinctly convey the information. It should probably link to the Future trait as well.
Given that the semantics of If we don't want to do that, then we should say |
Nit: the title doesn't mention async/await. |
I did link to closures to explain capture modes. I did not do so for |
Note to self: document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed some changes which I think should be uncontroversial, though feel free to revert/change it.
I think we'll need to add a note that trait functions/methods cannot be async (probably somewhere in items/traits.md?). FunctionQualifiers is reused and I think it should be explicit where it is and is not allowed there.
Also, this causes a problem with the definition of BareFunctionType. Syntactically it cannot have async
(AFAIK), so that will need to stop using FunctionQualifiers.
We normally only merge once things are stable on master, so the broken test should pass once that happens. I left a note on the other broken test.
FYI, we're still stuck on mdbook 0.1 here. The links are relative to the root of the book. Hopefully we'll get to upgrade soon.
Also, we use relative links between books (like std), so that they point to the correct version (on doc.rust-lang.org).
src/expressions/await-expr.md
Outdated
|
||
```rust,ignore | ||
loop { | ||
let tmp = /* <expr> */; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this line be outside of the loop? tmp
isn't re-evaluated every single time, right? Also, should probably call it awaited
and not tmp
.
Just a heads up, I have rebased this PR on latest master to resolve the conflicts, so be careful updating locally. The reference has migrated to mdbook 0.3. This means that links should use the |
Are there remaining blockers to landing this? |
The reference only includes stable features, so normally we wait until it is stabilized on nightly. IIUC, it is currently waiting on FCP in rust-lang/rust#62149? There are also some unresolved comments above. I'll take care of the formatting issue, but I don't know enough about async to do much else. Is there someone who can pick it up since Niko isn't around? There's an unresolved issue about "unsafe" being undocumented, but I personally think it would be ok to land that separately. Others may disagree, though. |
I pushed two commits -- one addresses @Havvy's nit, the other documents |
@nikomatsakis Btw, you can apply suggestions in bulk as a single commit if you go to the "Files changed" tab. Use the "Add suggestion to batch" button when you are there. |
@nikomatsakis Since the stabilization PR landed, want to make the finishing touches and then squash? Let's merge after that. |
8c56b41
to
e0b5db6
Compare
@Centril addressed (I think) all nits, squashed, and rebased |
Yep, thanks! We'll have to remember to adjust this if we adjust the lowering wrt. the temporary lifetime stuff. |
Update cargo, books ## cargo 8 commits in 22f7dd0495cd72ce2082d318d5a9b4dccb9c5b8c..fe0e5a48b75da2b405c8ce1ba2674e174ae11d5d 2019-08-27 16:10:51 +0000 to 2019-09-04 00:51:27 +0000 - Rename `--all` to `--workspace` (rust-lang/cargo#7241) - Basic standard library support. (rust-lang/cargo#7216) - Allow using 'config.toml' instead of just 'config' files. (rust-lang/cargo#7295) - Retry on SSL Connect Error. (rust-lang/cargo#7318) - minimal-copy `deserialize` for `InternedString` (rust-lang/cargo#7310) - Fix typo in cargo vendor examples (rust-lang/cargo#7320) - Fixes around multiple `[patch]` per crate (rust-lang/cargo#7303) - Improve error messages on mkdir failure (rust-lang/cargo#7306) ## reference 7 commits in d191a0c..090c015 2019-08-15 08:42:23 +0200 to 2019-09-03 13:59:28 -0700 - Fix rust-lang/reference#664: Review Oxford comma usage. (rust-lang/reference#668) - Fix some links. (rust-lang/reference#667) - Remove trait object warning. (rust-lang/reference#666) - Specify pattern types in `let` statements and `for` expressions (rust-lang/reference#663) - Fix loop expression link. (rust-lang/reference#662) - async-await initial reference material (rust-lang/reference#635) - Correct errors in the reference of extern functions definitions and declarations (rust-lang/reference#652) ## rust-by-example 1 commits in 580839d90aacd537f0293697096fa8355bc4e673..e76be6b2dc84c6a992e186157efe29d625e29b94 2019-08-17 23:17:50 -0300 to 2019-09-03 07:42:26 -0300 - Change link to russian translation repository (rust-lang/rust-by-example#1245) ## embedded-book 1 commits in 432ca26686c11d396eed6a59499f93ce1bf2433c..5ca585c4a7552efb546e7681c3de0712f4ae4fdc 2019-08-09 23:20:22 +0000 to 2019-08-27 13:39:14 +0000 - Fixup book CI (rust-embedded/book#205)
I'm not sure what the best reviewing process is here.
cc @cramertj @withoutboats @Centril @joshtriplett @pnkfelix @scottmcm @pnkfelix @eddyb (I think that's the lang team, did I miss anybody?)
cc #634 rust-lang/rust#62566