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