Skip to content

std: Improve option docs #12982

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

Merged
merged 1 commit into from
Mar 19, 2014
Merged

std: Improve option docs #12982

merged 1 commit into from
Mar 19, 2014

Conversation

brson
Copy link
Contributor

@brson brson commented Mar 17, 2014

Various improvements. There's a lot more that can be done.

///
/// # Example
///
/// Convert an `Option<~str>` into an `Option<int>`, preserving the original:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could say something like "using .map without .as_ref would consume num_as_str", to make it clearer why this is necessary?

@alexcrichton
Copy link
Member

r=me with comments, travis doesn't like one of the XXX markers though

@sfackler
Copy link
Member

Do we want the main body of documentation on the module or the type? I'd think that people would end up on the type after searching for it, so it may make more sense to put it there.

@kud1ing
Copy link

kud1ing commented Mar 19, 2014

See also #12971

bors added a commit that referenced this pull request Mar 19, 2014
Various improvements. There's a lot more that can be done.
@bors bors closed this Mar 19, 2014
@bors bors merged commit 8fcb8dd into rust-lang:master Mar 19, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 23, 2022
Implement IntoFuture type inference

One of my projects is using [IntoFuture](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) to make our async code a little less verbose. However, rust-analyzer can't infer the output type of an await expression if the value uses `IntoFuture` to convert into another type. So we're getting `{unknown}` types everywhere since switching.

`foo.await` itself [desugars](https://github.com/rust-lang/rust/blob/e4417cf020fbcd6182c11637bc6b8694434bd81a/compiler/rustc_ast_lowering/src/expr.rs#L644-L658) into a `match into_future(foo) {}`, with every `Future` impl getting a [default](https://github.com/rust-lang/rust/blob/e4417cf020fbcd6182c11637bc6b8694434bd81a/library/core/src/future/into_future.rs#L131-L139) `IntoFuture` implementation. I'm not sure if we want to disable the old `future_trait` paths, since this only recently [stabilize](rust-lang#98718).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants