1 // run-pass 2 #![allow(unused_must_use)] 3 // ignore-emscripten no threads support 4 5 use std::thread; 6 7 macro_rules! expr { ($e: expr) => { $e } } 8 9 macro_rules! spawn { 10 ($($code: tt)*) => { 11 expr!(thread::spawn(move|| {$($code)*}).join()) 12 } 13 } 14 main()15pub fn main() { 16 spawn! { 17 println!("stmt"); 18 }; 19 let _ = spawn! { 20 println!("expr"); 21 }; 22 } 23