rust/tests/ui/macros/macro-with-braces-in-expr-position.rs
2023-01-11 09:32:08 +00:00

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