]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/async-fn.rs
Rollup merge of #61438 - estebank:generics-span, r=varkor
[rust.git] / src / test / rustdoc / async-fn.rs
1 // edition:2018
2
3 #![feature(async_await)]
4
5 // @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option<Foo>'
6 pub async fn foo() -> Option<Foo> {
7     None
8 }
9
10 // @has async_fn/fn.bar.html '//pre[@class="rust fn"]' 'pub async fn bar(a: i32, b: i32) -> i32'
11 pub async fn bar(a: i32, b: i32) -> i32 {
12     0
13 }
14
15 // @has async_fn/fn.baz.html '//pre[@class="rust fn"]' 'pub async fn baz<T>(a: T) -> T'
16 pub async fn baz<T>(a: T) -> T {
17     a
18 }
19
20 trait Bar {}
21
22 impl Bar for () {}
23
24 // @has async_fn/fn.quux.html '//pre[@class="rust fn"]' 'pub async fn quux() -> impl Bar'
25 pub async fn quux() -> impl Bar {
26     ()
27 }
28
29 // @has async_fn/struct.Foo.html
30 // @matches - '//code' 'pub async fn f\(\)$'
31 pub struct Foo;
32
33 impl Foo {
34     pub async fn f() {}
35 }