fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
2.5 KiB72 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 |     *lock.lock().unwrap() = &*y;
5   |                             --- borrow of `*y` occurs here
6LL |     drop(y);
7   |          ^ move out of `y` occurs here
8...
9LL |         *lock.lock().unwrap() = &z;
10   |          ---- borrow later used here
11
12error[E0597]: `z` does not live long enough
13  --> $DIR/send-is-not-static-std-sync.rs:16:33
14   |
15LL |         *lock.lock().unwrap() = &z;
16   |                                 ^^ borrowed value does not live long enough
17LL |     }
18   |     - `z` dropped here while still borrowed
19LL |
20LL |     lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use)
21   |     ---- borrow later used here
22
23error[E0505]: cannot move out of `y` because it is borrowed
24  --> $DIR/send-is-not-static-std-sync.rs:27:10
25   |
26LL |     *lock.write().unwrap() = &*y;
27   |                              --- borrow of `*y` occurs here
28LL |     drop(y);
29   |          ^ move out of `y` occurs here
30...
31LL |         *lock.write().unwrap() = &z;
32   |          ---- borrow later used here
33
34error[E0597]: `z` does not live long enough
35  --> $DIR/send-is-not-static-std-sync.rs:30:34
36   |
37LL |         *lock.write().unwrap() = &z;
38   |                                  ^^ borrowed value does not live long enough
39LL |     }
40   |     - `z` dropped here while still borrowed
41LL |
42LL |     lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use)
43   |     ---- borrow later used here
44
45error[E0505]: cannot move out of `y` because it is borrowed
46  --> $DIR/send-is-not-static-std-sync.rs:43:10
47   |
48LL |     tx.send(&*y);
49   |             --- borrow of `*y` occurs here
50LL |     drop(y);
51   |          ^ move out of `y` occurs here
52...
53LL |         tx.send(&z).unwrap();
54   |         -- borrow later used here
55
56error[E0597]: `z` does not live long enough
57  --> $DIR/send-is-not-static-std-sync.rs:46:17
58   |
59LL |         tx.send(&z).unwrap();
60   |                 ^^ borrowed value does not live long enough
61LL |     }
62   |     - `z` dropped here while still borrowed
63...
64LL | }
65   | - borrow might be used here, when `tx` is dropped and runs the `Drop` code for type `std::sync::mpsc::Sender`
66   |
67   = note: values in a scope are dropped in the opposite order they are defined
68
69error: aborting due to 6 previous errors
70
71Some errors have detailed explanations: E0505, E0597.
72For more information about an error, try `rustc --explain E0505`.