about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-02-10 21:45:12 +0100
committerGitHub <noreply@github.com>2019-02-10 21:45:12 +0100
commitcdbd07cc40bc0cedbf38ffb6b69465e0cff6eff6 (patch)
tree2cdfe4359051678d9c6b9077bc82008b47b8de10 /src/test
parenta74e4f7fd5fd0eac66a021bfb108942ad1ec3995 (diff)
parent4deb5959a3a2cbc189e26cb4b0c59a6707a10b45 (diff)
downloadrust-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')
-rw-r--r--src/test/rustdoc/async-fn.rs35
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() {}
 }