3 // Test that we get the expected borrow check errors when an async
4 // function (which takes multiple lifetimes) only returns data from
7 async fn multiple_named_lifetimes<'a, 'b>(a: &'a u8, _: &'b u8) -> &'a u8 {
11 // Both are borrowed whilst the future is live.
12 async fn future_live() {
15 let future = multiple_named_lifetimes(&a, &b);
16 a += 1; //~ ERROR cannot assign
17 b += 1; //~ ERROR cannot assign
22 // Just the return value is live after future is awaited.
23 async fn just_return_live() {
26 let future = multiple_named_lifetimes(&a, &b);
28 a += 1; //~ ERROR cannot assign
33 // Once `p` is dead, both `a` and `b` are unborrowed.
34 async fn after_both_dead() {
37 let future = multiple_named_lifetimes(&a, &b);