summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-16560.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-16560.rs')
-rw-r--r--tests/ui/issues/issue-16560.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-16560.rs b/tests/ui/issues/issue-16560.rs
new file mode 100644
index 000000000..d5fffc7ef
--- /dev/null
+++ b/tests/ui/issues/issue-16560.rs
@@ -0,0 +1,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();
+}