fork/rust

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

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

master
2.9 KiB85 linesraw
1error[E0505]: cannot move out of `y` because it is borrowed
2  --> $DIR/send-is-not-static-std-sync.rs:13:10
3   |
4LL |     let y = Box::new(1);
5   |         - binding `y` declared here
6LL |     let lock = Mutex::new(&x);
7LL |     *lock.lock().unwrap() = &*y;
8   |                             --- borrow of `*y` occurs here
9LL |     drop(y);
10   |          ^ move out of `y` occurs here
11...
12LL |         *lock.lock().unwrap() = &z;
13   |          ---- borrow later used here
14
15error[E0597]: `z` does not live long enough
16  --> $DIR/send-is-not-static-std-sync.rs:16:33
17   |
18LL |         let z = 2;
19   |             - binding `z` declared here
20LL |         *lock.lock().unwrap() = &z;
21   |                                 ^^ borrowed value does not live long enough
22LL |     }
23   |     - `z` dropped here while still borrowed
24LL |
25LL |     lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use)
26   |     ---- borrow later used here
27
28error[E0505]: cannot move out of `y` because it is borrowed
29  --> $DIR/send-is-not-static-std-sync.rs:27:10
30   |
31LL |     let y = Box::new(1);
32   |         - binding `y` declared here
33LL |     let lock = RwLock::new(&x);
34LL |     *lock.write().unwrap() = &*y;
35   |                              --- borrow of `*y` occurs here
36LL |     drop(y);
37   |          ^ move out of `y` occurs here
38...
39LL |         *lock.write().unwrap() = &z;
40   |          ---- borrow later used here
41
42error[E0597]: `z` does not live long enough
43  --> $DIR/send-is-not-static-std-sync.rs:30:34
44   |
45LL |         let z = 2;
46   |             - binding `z` declared here
47LL |         *lock.write().unwrap() = &z;
48   |                                  ^^ borrowed value does not live long enough
49LL |     }
50   |     - `z` dropped here while still borrowed
51LL |
52LL |     lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use)
53   |     ---- borrow later used here
54
55error[E0505]: cannot move out of `y` because it is borrowed
56  --> $DIR/send-is-not-static-std-sync.rs:43:10
57   |
58LL |     let y = Box::new(1);
59   |         - binding `y` declared here
60...
61LL |     tx.send(&*y);
62   |             --- borrow of `*y` occurs here
63LL |     drop(y);
64   |          ^ move out of `y` occurs here
65...
66LL |         tx.send(&z).unwrap();
67   |         -- borrow later used here
68
69error[E0597]: `z` does not live long enough
70  --> $DIR/send-is-not-static-std-sync.rs:46:17
71   |
72LL |         let z = 2;
73   |             - binding `z` declared here
74LL |         tx.send(&z).unwrap();
75   |                 ^^ borrowed value does not live long enough
76LL |     }
77   |     - `z` dropped here while still borrowed
78LL |
79LL |     tx.use_ref(); // (channel drop glue does not use `z` => needs explicit use)
80   |     -- borrow later used here
81
82error: aborting due to 6 previous errors
83
84Some errors have detailed explanations: E0505, E0597.
85For more information about an error, try `rustc --explain E0505`.