rust/tests/ui/macros/macro-with-braces-in-expr-position.rs
2024-02-16 20:02:50 +00:00

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");
};
}