mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 19:43:43 +00:00
23 lines
373 B
Rust
23 lines
373 B
Rust
//@ run-pass
|
|
#![allow(unused_must_use)]
|
|
//@ ignore-emscripten no threads support
|
|
|
|
use std::thread;
|
|
|
|
macro_rules! expr { ($e: expr) => { $e } }
|
|
|
|
macro_rules! spawn {
|
|
($($code: tt)*) => {
|
|
expr!(thread::spawn(move|| {$($code)*}).join())
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
spawn! {
|
|
println!("stmt");
|
|
};
|
|
let _ = spawn! {
|
|
println!("expr");
|
|
};
|
|
}
|