summary refs log tree commit diff
path: root/tests/ui/borrowck/moved-value-in-thread-loop-12041.rs
blob: 98f9cdbdef79041806a9e1217328552f9d85285f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! 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);
        }
    });
}