| error[E0506]: cannot assign to `*x` because it is borrowed |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:9:5 |
| | |
| LL | pub async fn async_fn(x: &mut i32) -> &i32 { |
| | - let's call the lifetime of this reference `'1` |
| LL | let y = &*x; |
| | --- `*x` is borrowed here |
| LL | *x += 1; |
| | ^^^^^^^ `*x` is assigned to here but it was already borrowed |
| LL | y |
| | - returning this value requires that `*x` is borrowed for `'1` |
| |
| error[E0506]: cannot assign to `*x` because it is borrowed |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:18:9 |
| | |
| LL | (async move || { |
| | - return type of async closure is &'1 i32 |
| ... |
| LL | let y = &*x; |
| | --- `*x` is borrowed here |
| LL | *x += 1; |
| | ^^^^^^^ `*x` is assigned to here but it was already borrowed |
| LL | y |
| | - returning this value requires that `*x` is borrowed for `'1` |
| |
| error: lifetime may not live long enough |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:14:20 |
| | |
| LL | (async move || { |
| | ______-------------_^ |
| | | | | |
| | | | return type of async closure `{async closure body@$DIR/issue-74072-lifetime-name-annotations.rs:14:20: 20:6}` contains a lifetime `'2` |
| | | lifetime `'1` represents this closure's body |
| LL | | |
| LL | | |
| LL | | let y = &*x; |
| LL | | *x += 1; |
| LL | | y |
| LL | | })() |
| | |_____^ returning this value requires that `'1` must outlive `'2` |
| | |
| = note: closure implements `FnMut`, so references to captured variables can't escape the closure |
| |
| error[E0716]: temporary value dropped while borrowed |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:14:5 |
| | |
| LL | pub fn async_closure(x: &mut i32) -> impl Future<Output=&i32> { |
| | - let's call the lifetime of this reference `'1` |
| LL | // (async move || { |
| LL | || |
| LL | || |
| LL | || let y = &*x; |
| LL | || *x += 1; |
| LL | || y |
| LL | || })() |
| | ||______^_- argument requires that borrow lasts for `'1` |
| | |_______| |
| | creates a temporary value which is freed while still in use |
| LL | } |
| | - temporary value is freed at the end of this statement |
| |
| error[E0506]: cannot assign to `*x` because it is borrowed |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:28:9 |
| | |
| LL | (async move || -> &i32 { |
| | - return type of async closure is &'1 i32 |
| ... |
| LL | let y = &*x; |
| | --- `*x` is borrowed here |
| LL | *x += 1; |
| | ^^^^^^^ `*x` is assigned to here but it was already borrowed |
| LL | y |
| | - returning this value requires that `*x` is borrowed for `'1` |
| |
| error: lifetime may not live long enough |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:24:28 |
| | |
| LL | (async move || -> &i32 { |
| | ______---------------------_^ |
| | | | | |
| | | | return type of async closure `{async closure body@$DIR/issue-74072-lifetime-name-annotations.rs:24:28: 30:6}` contains a lifetime `'2` |
| | | lifetime `'1` represents this closure's body |
| LL | | |
| LL | | |
| LL | | let y = &*x; |
| LL | | *x += 1; |
| LL | | y |
| LL | | })() |
| | |_____^ returning this value requires that `'1` must outlive `'2` |
| | |
| = note: closure implements `FnMut`, so references to captured variables can't escape the closure |
| |
| error[E0716]: temporary value dropped while borrowed |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:24:5 |
| | |
| LL | pub fn async_closure_explicit_return_type(x: &mut i32) -> impl Future<Output=&i32> { |
| | - let's call the lifetime of this reference `'1` |
| LL | // (async move || -> &i32 { |
| LL | || |
| LL | || |
| LL | || let y = &*x; |
| LL | || *x += 1; |
| LL | || y |
| LL | || })() |
| | ||______^_- argument requires that borrow lasts for `'1` |
| | |_______| |
| | creates a temporary value which is freed while still in use |
| LL | } |
| | - temporary value is freed at the end of this statement |
| |
| error[E0506]: cannot assign to `*x` because it is borrowed |
| --> $DIR/issue-74072-lifetime-name-annotations.rs:36:9 |
| | |
| LL | async move { |
| | - return type of async block is &'1 i32 |
| LL | let y = &*x; |
| | --- `*x` is borrowed here |
| LL | *x += 1; |
| | ^^^^^^^ `*x` is assigned to here but it was already borrowed |
| LL | y |
| | - returning this value requires that `*x` is borrowed for `'1` |
| |
| error: aborting due to 8 previous errors |
| |
| Some errors have detailed explanations: E0506, E0716. |
| For more information about an error, try `rustc --explain E0506`. |