@@ -49,6 +49,8 @@ impl Foo {
49
49
pub async fn mut_self ( mut self , mut first : usize ) { }
50
50
}
51
51
52
+ pub trait Pattern < ' a > { }
53
+
52
54
pub trait Trait < const N : usize > { }
53
55
// @has async_fn/fn.const_generics.html
54
56
// @has - '//pre[@class="rust fn"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)'
@@ -70,6 +72,9 @@ pub async fn static_trait(foo: &str) -> Box<dyn Bar> {}
70
72
// @has async_fn/fn.lifetime_for_trait.html
71
73
// @has - '//pre[@class="rust fn"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>"
72
74
pub async fn lifetime_for_trait ( foo : & str ) -> Box < dyn Bar + ' _ > { }
75
+ // @has async_fn/fn.elided_in_input_trait.html
76
+ // @has - '//pre[@class="rust fn"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)"
77
+ pub async fn elided_in_input_trait ( t : impl Pattern < ' _ > ) { }
73
78
74
79
struct AsyncFdReadyGuard < ' a , T > { x : & ' a T }
75
80
@@ -80,4 +85,14 @@ impl Foo {
80
85
// taken from `tokio` as an example of a method that was particularly bad before
81
86
// @has - '//h4[@class="method"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>"
82
87
pub async fn readable < T > ( & self ) -> Result < AsyncFdReadyGuard < ' _ , T > , ( ) > { }
88
+ // @has - '//h4[@class="method"]' "pub async fn mut_self(&mut self)"
89
+ pub async fn mut_self ( & mut self ) { }
83
90
}
91
+
92
+ // test named lifetimes, just in case
93
+ // @has async_fn/fn.named.html
94
+ // @has - '//pre[@class="rust fn"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str"
95
+ pub async fn named < ' a , ' b > ( foo : & ' a str ) -> & ' b str { }
96
+ // @has async_fn/fn.named_trait.html
97
+ // @has - '//pre[@class="rust fn"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>"
98
+ pub async fn named_trait < ' a , ' b > ( foo : impl Pattern < ' a > ) -> impl Pattern < ' b > { }
0 commit comments