Skip to content
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

Rustdoc renders async fn incorrectly #58027

Closed
ebkalderon opened this issue Jan 31, 2019 · 0 comments

Comments

@ebkalderon
Copy link

commented Jan 31, 2019

Summary

While experimenting with async fn and await!() on nightly Rust, I noticed that cargo doc renders them incorrectly. It displays the following:

pub async fn foo(&self, bar: Bar) -> impl Future<Output = Option<Baz>> + '_

I expected the output to be something like this:

pub async fn foo(&self, bar: Bar) -> Option<Baz>

I believe having async fn displayed as returning an impl Future like that is misleading because the async keyword at the beginning makes it seem like the return value is a nested future, when it really isn't. That is, it erroneously suggests that the desugared form of the async fn is:

pub fn foo(&self, bar: Bar) -> impl Future<Output = impl Future<Output = Option<Baz>> + '_> + '_

Toolchain information

  • rustc 1.33.0-nightly (b43986184 2019-01-11)
  • rustdoc 1.33.0-nightly (b43986184 2019-01-11)
  • macOS Mojave 10.14.2 (x86_64-apple-darwin)

How to reproduce

The minimal verifiable example for this issue is essentially creating a new Cargo project with some trivial async fn code in it, and then running cargo doc --open.

@csmoe csmoe added the T-rustdoc label Jan 31, 2019

kennytm added a commit to kennytm/rust that referenced this issue Feb 8, 2019
Rollup merge of rust-lang#58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions

Fixes rust-lang#58027.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Feb 10, 2019
Rollup merge of rust-lang#58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions

Fixes rust-lang#58027.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Feb 10, 2019
Rollup merge of rust-lang#58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions

Fixes rust-lang#58027.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Feb 10, 2019
Rollup merge of rust-lang#58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions

Fixes rust-lang#58027.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Feb 10, 2019
Rollup merge of rust-lang#58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions

Fixes rust-lang#58027.

@bors bors closed this in #58203 Feb 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.