fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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