|
1 | 1 | $ cargo run
|
2 | 2 | Compiling shared-state v0.1.0 (file:///projects/shared-state)
|
3 |
| -error[E0277]: `std::rc::Rc<std::sync::Mutex<i32>>` cannot be sent between threads safely |
4 |
| - --> src/main.rs:11:22 |
5 |
| - | |
6 |
| -11 | let handle = thread::spawn(move || { |
7 |
| - | ^^^^^^^^^^^^^ `std::rc::Rc<std::sync::Mutex<i32>>` cannot be sent between threads safely |
8 |
| - | |
9 |
| - = help: within `[closure@src/main.rs:11:36: 15:10 counter:std::rc::Rc<std::sync::Mutex<i32>>]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::sync::Mutex<i32>>` |
10 |
| - = note: required because it appears within the type `[closure@src/main.rs:11:36: 15:10 counter:std::rc::Rc<std::sync::Mutex<i32>>]` |
11 |
| - |
12 |
| -error: aborting due to previous error |
| 3 | +error[E0277]: `Rc<Mutex<i32>>` cannot be sent between threads safely |
| 4 | +(エラー: `Rc<Mutex<i32>>`はスレッド間で安全に送信できません) |
| 5 | + --> src/main.rs:11:36 |
| 6 | + | |
| 7 | +11 | let handle = thread::spawn(move || { |
| 8 | + | ------------- ^------ |
| 9 | + | | | |
| 10 | + | ______________________|_____________within this `{closure@src/main.rs:11:36: 11:43}` |
| 11 | + | | | (この`{[closure@src/main.rs:11:36: 11:43}`の中で) |
| 12 | + | | | |
| 13 | + | | required by a bound introduced by this call |
| 14 | + | | (この呼び出しによって導入される境界によって必要とされます) |
| 15 | +12 | | let mut num = counter.lock().unwrap(); |
| 16 | +13 | | |
| 17 | +14 | | *num += 1; |
| 18 | +15 | | }); |
| 19 | + | |_________^ `Rc<Mutex<i32>>` cannot be sent between threads safely |
| 20 | + | (`Rc<Mutex<i32>>`はスレッド間で安全に送信できません) |
| 21 | + | |
| 22 | + = help: within `{closure@src/main.rs:11:36: 11:43}`, the trait `Send` is not implemented for `Rc<Mutex<i32>>` |
| 23 | + =(ヘルプ: `{closure@src/main.rs:11:36: 11:43}`の中で、トレイト`Send`は`Rc<Mutex<i32>>`に対して実装されていません |
| 24 | +note: required because it's used within this closure |
| 25 | +(注釈: このクロージャの中で使用されているので、要求されます) |
| 26 | + --> src/main.rs:11:36 |
| 27 | + | |
| 28 | +11 | let handle = thread::spawn(move || { |
| 29 | + | ^^^^^^^ |
| 30 | +note: required by a bound in `spawn` |
| 31 | +(注釈: `spawn`の境界によって要求されます) |
| 32 | + --> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/mod.rs:678:1 |
13 | 33 |
|
14 | 34 | For more information about this error, try `rustc --explain E0277`.
|
15 |
| -error: could not compile `shared-state`. |
16 |
| - |
17 |
| -To learn more, run the command again with --verbose. |
| 35 | +error: could not compile `shared-state` (bin "shared-state") due to 1 previous error |
0 commit comments