blob: e1b714652737fb8ce51b8ff36ee9b5740b1e47a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// edition:2018
// Test that a feature gate is needed to use `impl Trait` as the
// return type of an async.
#![feature(async_await, member_constraints)]
trait Trait<'a> { }
impl<T> Trait<'_> for T { }
// Only `'a` permitted in return type, not `'b`.
async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
//~^ ERROR lifetime mismatch
(a, b)
}
// As above, but `'b: 'a`, so return type can be inferred to `(&'a u8,
// &'a u8)`.
async fn async_ret_impl_trait2<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a>
where
'b: 'a,
{
(a, b)
}
fn main() {
}
|