forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions Fixes rust-lang#58027.
- Loading branch information
Showing
4 changed files
with
88 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
// edition:2018 | ||
// compile-flags:-Z unstable-options | ||
|
||
// FIXME: once `--edition` is stable in rustdoc, remove that `compile-flags` directive | ||
|
||
#![feature(async_await, futures_api)] | ||
|
||
// @has async_fn/struct.S.html | ||
// @has - '//code' 'pub async fn f()' | ||
pub struct S; | ||
// @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option<Foo>' | ||
pub async fn foo() -> Option<Foo> { | ||
None | ||
} | ||
|
||
// @has async_fn/fn.bar.html '//pre[@class="rust fn"]' 'pub async fn bar(a: i32, b: i32) -> i32' | ||
pub async fn bar(a: i32, b: i32) -> i32 { | ||
0 | ||
} | ||
|
||
// @has async_fn/fn.baz.html '//pre[@class="rust fn"]' 'pub async fn baz<T>(a: T) -> T' | ||
pub async fn baz<T>(a: T) -> T { | ||
a | ||
} | ||
|
||
trait Bar {} | ||
|
||
impl Bar for () {} | ||
|
||
// @has async_fn/fn.quux.html '//pre[@class="rust fn"]' 'pub async fn quux() -> impl Bar' | ||
pub async fn quux() -> impl Bar { | ||
() | ||
} | ||
|
||
// @has async_fn/struct.Foo.html | ||
// @matches - '//code' 'pub async fn f\(\)$' | ||
pub struct Foo; | ||
|
||
impl S { | ||
impl Foo { | ||
pub async fn f() {} | ||
} |