rust/tests/ui/borrowck/moved-value-in-thread-loop-12041.rs
2025-07-31 21:25:49 +05:00

16 lines
337 B
Rust

//! Regression test for https://github.com/rust-lang/rust/issues/12041
use std::sync::mpsc::channel;
use std::thread;
fn main() {
let (tx, rx) = channel();
let _t = thread::spawn(move|| -> () {
loop {
let tx = tx;
//~^ ERROR: use of moved value: `tx`
tx.send(1);
}
});
}