-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Open
Description
Hello,
I have a problem, when I run rustlings for the thread3.rs, it works perfectely I do the exercice. But when I try to compile manually with rustc (version rustc 1.88.0 (6b00bc388 2025-06-23)), there is an error :
error[E0382]: use of moved value: `q`
--> threads3.rs:32:19
|
17 | fn send_tx(q: Queue, tx: mpsc::Sender<u32>) {
| - move occurs because `q` has type `Queue`, which does not implement the `Copy` trait
...
24 | thread::spawn(move || {
| ------- value moved into closure here
25 | for val in q.first_half {
| ------------ variable moved due to use in closure
...
32 | thread::spawn(move || {
| ^^^^^^^ value used here after move
33 | for val in q.second_half {
| ------------- use occurs due to use in closure
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0382`.
I don't know why the file don't compile manually but compile with rustlings. The solution also don't compile, with the same error.
The command I am using, to compile manualy is rustc threads3.rs
.
Regards,
Metadata
Metadata
Assignees
Labels
No labels