summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros/macro-with-braces-in-expr-position.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/macros/macro-with-braces-in-expr-position.rs')
-rw-r--r--tests/ui/macros/macro-with-braces-in-expr-position.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/macros/macro-with-braces-in-expr-position.rs b/tests/ui/macros/macro-with-braces-in-expr-position.rs
new file mode 100644
index 000000000..f7d87434d
--- /dev/null
+++ b/tests/ui/macros/macro-with-braces-in-expr-position.rs
@@ -0,0 +1,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");
+ };
+}