@@ -48,6 +48,8 @@ impl Foo {
48
48
49
49
pub trait Pattern < ' a > { }
50
50
51
+ impl Pattern < ' _ > for ( ) { }
52
+
51
53
pub trait Trait < const N : usize > { }
52
54
// @has async_fn/fn.const_generics.html
53
55
// @has - '//pre[@class="rust item-decl"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)'
@@ -57,18 +59,18 @@ pub async fn const_generics<const N: usize>(_: impl Trait<N>) {}
57
59
// regression test for #63037
58
60
// @has async_fn/fn.elided.html
59
61
// @has - '//pre[@class="rust item-decl"]' 'pub async fn elided(foo: &str) -> &str'
60
- pub async fn elided ( foo : & str ) -> & str { }
62
+ pub async fn elided ( foo : & str ) -> & str { "" }
61
63
// This should really be shown as written, but for implementation reasons it's difficult.
62
64
// See `impl Clean for TyKind::Ref`.
63
65
// @has async_fn/fn.user_elided.html
64
66
// @has - '//pre[@class="rust item-decl"]' 'pub async fn user_elided(foo: &str) -> &str'
65
- pub async fn user_elided ( foo : & ' _ str ) -> & str { }
67
+ pub async fn user_elided ( foo : & ' _ str ) -> & str { "" }
66
68
// @has async_fn/fn.static_trait.html
67
69
// @has - '//pre[@class="rust item-decl"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>'
68
- pub async fn static_trait ( foo : & str ) -> Box < dyn Bar > { }
70
+ pub async fn static_trait ( foo : & str ) -> Box < dyn Bar > { Box :: new ( ( ) ) }
69
71
// @has async_fn/fn.lifetime_for_trait.html
70
72
// @has - '//pre[@class="rust item-decl"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>"
71
- pub async fn lifetime_for_trait ( foo : & str ) -> Box < dyn Bar + ' _ > { }
73
+ pub async fn lifetime_for_trait ( foo : & str ) -> Box < dyn Bar + ' _ > { Box :: new ( ( ) ) }
72
74
// @has async_fn/fn.elided_in_input_trait.html
73
75
// @has - '//pre[@class="rust item-decl"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)"
74
76
pub async fn elided_in_input_trait ( t : impl Pattern < ' _ > ) { }
@@ -78,18 +80,20 @@ struct AsyncFdReadyGuard<'a, T> { x: &'a T }
78
80
impl Foo {
79
81
// @has async_fn/struct.Foo.html
80
82
// @has - '//*[@class="method"]' 'pub async fn complicated_lifetimes( &self, context: &impl Bar ) -> impl Iterator<Item = &usize>'
81
- pub async fn complicated_lifetimes ( & self , context : & impl Bar ) -> impl Iterator < Item = & usize > { }
83
+ pub async fn complicated_lifetimes ( & self , context : & impl Bar ) -> impl Iterator < Item = & usize > {
84
+ [ 0 ] . iter ( )
85
+ }
82
86
// taken from `tokio` as an example of a method that was particularly bad before
83
87
// @has - '//*[@class="method"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>"
84
- pub async fn readable < T > ( & self ) -> Result < AsyncFdReadyGuard < ' _ , T > , ( ) > { }
88
+ pub async fn readable < T > ( & self ) -> Result < AsyncFdReadyGuard < ' _ , T > , ( ) > { Err ( ( ) ) }
85
89
// @has - '//*[@class="method"]' "pub async fn mut_self(&mut self)"
86
90
pub async fn mut_self ( & mut self ) { }
87
91
}
88
92
89
93
// test named lifetimes, just in case
90
94
// @has async_fn/fn.named.html
91
95
// @has - '//pre[@class="rust item-decl"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str"
92
- pub async fn named < ' a , ' b > ( foo : & ' a str ) -> & ' b str { }
96
+ pub async fn named < ' a , ' b > ( foo : & ' a str ) -> & ' b str { "" }
93
97
// @has async_fn/fn.named_trait.html
94
98
// @has - '//pre[@class="rust item-decl"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>"
95
99
pub async fn named_trait < ' a , ' b > ( foo : impl Pattern < ' a > ) -> impl Pattern < ' b > { }
0 commit comments