diff options
| author | Andy Russell <arussell123@gmail.com> | 2019-02-05 10:12:43 -0500 |
|---|---|---|
| committer | Andy Russell <arussell123@gmail.com> | 2019-02-06 09:24:03 -0500 |
| commit | 4deb5959a3a2cbc189e26cb4b0c59a6707a10b45 (patch) | |
| tree | 6e1eec18108e8381b0524e9e6b002e18a34a6066 /src/test/rustdoc | |
| parent | d30b99f9c23f8e1d6ef993cc94da96510ad709b3 (diff) | |
| download | rust-4deb5959a3a2cbc189e26cb4b0c59a6707a10b45.tar.gz rust-4deb5959a3a2cbc189e26cb4b0c59a6707a10b45.zip | |
display sugared return types for async functions
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/async-fn.rs | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index a0b6c291260..ba4997a7f9b 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -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() {} } |
