diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-02-10 21:45:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-10 21:45:12 +0100 |
| commit | cdbd07cc40bc0cedbf38ffb6b69465e0cff6eff6 (patch) | |
| tree | 2cdfe4359051678d9c6b9077bc82008b47b8de10 /src/test/rustdoc | |
| parent | a74e4f7fd5fd0eac66a021bfb108942ad1ec3995 (diff) | |
| parent | 4deb5959a3a2cbc189e26cb4b0c59a6707a10b45 (diff) | |
| download | rust-cdbd07cc40bc0cedbf38ffb6b69465e0cff6eff6.tar.gz rust-cdbd07cc40bc0cedbf38ffb6b69465e0cff6eff6.zip | |
Rollup merge of #58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions Fixes #58027.
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() {} } |
