summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-16560.rs
blob: d5fffc7ef9bc1d013f69b8d035b57b890378fd38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// run-pass
#![allow(unused_variables)]
// ignore-emscripten no threads support

use std::thread;
use std::mem;

fn main() {
    let y = 0u8;
    let closure = move |x: u8| y + x;

    // Check that both closures are capturing by value
    assert_eq!(1, mem::size_of_val(&closure));

    thread::spawn(move|| {
        let ok = closure;
    }).join().ok().unwrap();
}