]>
Commit | Line | Data |
---|---|---|
74b04a01 XL |
1 | $ cargo run |
2 | Compiling shared-state v0.1.0 (file:///projects/shared-state) | |
fc512014 | 3 | error[E0277]: `Rc<Mutex<i32>>` cannot be sent between threads safely |
74b04a01 XL |
4 | --> src/main.rs:11:22 |
5 | | | |
fc512014 XL |
6 | 11 | let handle = thread::spawn(move || { |
7 | | ______________________^^^^^^^^^^^^^_- | |
8 | | | | | |
9 | | | `Rc<Mutex<i32>>` cannot be sent between threads safely | |
10 | 12 | | let mut num = counter.lock().unwrap(); | |
11 | 13 | | | |
12 | 14 | | *num += 1; | |
13 | 15 | | }); | |
14 | | |_________- within this `[closure@src/main.rs:11:36: 15:10]` | |
74b04a01 | 15 | | |
fc512014 XL |
16 | = help: within `[closure@src/main.rs:11:36: 15:10]`, the trait `Send` is not implemented for `Rc<Mutex<i32>>` |
17 | = note: required because it appears within the type `[closure@src/main.rs:11:36: 15:10]` | |
a2a8927a | 18 | note: required by a bound in `spawn` |
74b04a01 | 19 | |
74b04a01 | 20 | For more information about this error, try `rustc --explain E0277`. |
c295e0f8 | 21 | error: could not compile `shared-state` due to previous error |