summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros/macro-with-braces-in-expr-position.rs
blob: f7d87434dedd064ea21fa7c9202254c4471c4121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 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");
    };
}