2019-03-26 20:21:36 +00:00
|
|
|
$ cargo run
|
|
|
|
Compiling shared-state v0.1.0 (file:///projects/shared-state)
|
2020-12-05 02:35:15 +00:00
|
|
|
error[E0277]: `Rc<Mutex<i32>>` cannot be sent between threads safely
|
2022-11-04 02:10:09 +00:00
|
|
|
--> src/main.rs:11:36
|
2022-11-04 01:55:26 +00:00
|
|
|
|
|
2022-11-04 02:10:09 +00:00
|
|
|
11 | let handle = thread::spawn(move || {
|
|
|
|
| ------------- ^------
|
|
|
|
| | |
|
|
|
|
| ______________________|_____________within this `[closure@src/main.rs:11:36: 11:43]`
|
|
|
|
| | |
|
|
|
|
| | required by a bound introduced by this call
|
|
|
|
12 | | let mut num = counter.lock().unwrap();
|
|
|
|
13 | |
|
|
|
|
14 | | *num += 1;
|
|
|
|
15 | | });
|
|
|
|
| |_________^ `Rc<Mutex<i32>>` cannot be sent between threads safely
|
2022-11-04 01:55:26 +00:00
|
|
|
|
|
2022-11-04 02:04:05 +00:00
|
|
|
= help: within `[closure@src/main.rs:11:36: 11:43]`, the trait `Send` is not implemented for `Rc<Mutex<i32>>`
|
2022-11-04 01:55:26 +00:00
|
|
|
note: required because it's used within this closure
|
|
|
|
--> src/main.rs:11:36
|
|
|
|
|
|
2022-11-04 02:04:05 +00:00
|
|
|
11 | let handle = thread::spawn(move || {
|
|
|
|
| ^^^^^^^
|
2021-12-05 03:16:45 +00:00
|
|
|
note: required by a bound in `spawn`
|
2023-02-10 16:01:09 +00:00
|
|
|
--> /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/thread/mod.rs:704:8
|
|
|
|
|
|
|
|
|
= note: required by this bound in `spawn`
|
2019-03-26 20:21:36 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|
2021-09-16 01:49:30 +00:00
|
|
|
error: could not compile `shared-state` due to previous error
|