]>
Commit | Line | Data |
---|---|---|
29967ef6 XL |
1 | error[E0506]: cannot assign to `*x` because it is borrowed |
2 | --> $DIR/issue-74072-lifetime-name-annotations.rs:9:5 | |
3 | | | |
4 | LL | pub async fn async_fn(x: &mut i32) -> &i32 { | |
fc512014 | 5 | | - let's call the lifetime of this reference `'1` |
29967ef6 XL |
6 | LL | let y = &*x; |
7 | | --- borrow of `*x` occurs here | |
8 | LL | *x += 1; | |
9 | | ^^^^^^^ assignment to borrowed `*x` occurs here | |
10 | LL | y | |
11 | | - returning this value requires that `*x` is borrowed for `'1` | |
12 | ||
13 | error[E0506]: cannot assign to `*x` because it is borrowed | |
14 | --> $DIR/issue-74072-lifetime-name-annotations.rs:16:9 | |
15 | | | |
16 | LL | let y = &*x; | |
17 | | --- borrow of `*x` occurs here | |
18 | LL | *x += 1; | |
19 | | ^^^^^^^ assignment to borrowed `*x` occurs here | |
20 | LL | y | |
21 | | - returning this value requires that `*x` is borrowed for `'1` | |
22 | LL | })() | |
23 | | - return type of async closure is &'1 i32 | |
24 | ||
25 | error[E0506]: cannot assign to `*x` because it is borrowed | |
26 | --> $DIR/issue-74072-lifetime-name-annotations.rs:24:9 | |
27 | | | |
28 | LL | (async move || -> &i32 { | |
29 | | - let's call the lifetime of this reference `'1` | |
30 | LL | let y = &*x; | |
31 | | --- borrow of `*x` occurs here | |
32 | LL | *x += 1; | |
33 | | ^^^^^^^ assignment to borrowed `*x` occurs here | |
34 | LL | y | |
35 | | - returning this value requires that `*x` is borrowed for `'1` | |
36 | ||
37 | error[E0506]: cannot assign to `*x` because it is borrowed | |
38 | --> $DIR/issue-74072-lifetime-name-annotations.rs:32:9 | |
39 | | | |
40 | LL | let y = &*x; | |
41 | | --- borrow of `*x` occurs here | |
42 | LL | *x += 1; | |
43 | | ^^^^^^^ assignment to borrowed `*x` occurs here | |
44 | LL | y | |
45 | | - returning this value requires that `*x` is borrowed for `'1` | |
46 | LL | } | |
47 | | - return type of async block is &'1 i32 | |
48 | ||
49 | error: aborting due to 4 previous errors | |
50 | ||
51 | For more information about this error, try `rustc --explain E0506`. |