Closed
Description
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
.