diff options
Diffstat (limited to 'tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs')
| -rw-r--r-- | tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs | 15 | 
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs b/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs index 63cf3ff4049..79a71e968f9 100644 --- a/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs +++ b/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs @@ -3,19 +3,24 @@ use std::thread; -pub fn main() { test05(); } +pub fn main() { + test05(); +} -fn test05_start<F:FnOnce(isize)>(f: F) { +fn test05_start<F: FnOnce(isize)>(f: F) { f(22); } fn test05() { let three: Box<_> = Box::new(3); - let fn_to_send = move|n:isize| { + let fn_to_send = move |n: isize| { println!("{}", *three + n); // will copy x into the closure assert_eq!(*three, 3); }; - thread::spawn(move|| { + thread::spawn(move || { test05_start(fn_to_send); - }).join().ok().unwrap(); + }) + .join() + .ok() + .unwrap(); }  | 
