]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr
Rollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkin
[rust.git] / tests / ui / async-await / issue-74072-lifetime-name-annotations.stderr
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 {
5    |                          - let's call the lifetime of this reference `'1`
6 LL |     let y = &*x;
7    |             --- `*x` is borrowed here
8 LL |     *x += 1;
9    |     ^^^^^^^ `*x` is assigned to here but it was already borrowed
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    |                 --- `*x` is borrowed here
18 LL |         *x += 1;
19    |         ^^^^^^^ `*x` is assigned to here but it was already borrowed
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    |                 --- `*x` is borrowed here
32 LL |         *x += 1;
33    |         ^^^^^^^ `*x` is assigned to here but it was already borrowed
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    |                 --- `*x` is borrowed here
42 LL |         *x += 1;
43    |         ^^^^^^^ `*x` is assigned to here but it was already borrowed
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`.