about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-08-12 20:58:31 +0000
committerbors <bors@rust-lang.org>2015-08-12 20:58:31 +0000
commit6a5c4e77a841754656b9942624edf916defc005c (patch)
tree827059957558c261d50c866e7e74d9bda8021aa9 /src/test
parentd07d465cf60033e35eba16b9e431471d54c712f4 (diff)
parenta016dfb1d110f7dfcd5f8e36ed02c2fd029532d3 (diff)
downloadrust-6a5c4e77a841754656b9942624edf916defc005c.tar.gz
rust-6a5c4e77a841754656b9942624edf916defc005c.zip
Auto merge of #27691 - jonas-schievink:for-macro, r=alexcrichton
Closes #27004
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/for-loop-macro.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/run-pass/for-loop-macro.rs b/src/test/run-pass/for-loop-macro.rs
new file mode 100644
index 00000000000..17c5a98246b
--- /dev/null
+++ b/src/test/run-pass/for-loop-macro.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! var {
+    ( $name:ident ) => ( $name );
+}
+
+pub fn main() {
+    let x = [ 3, 3, 3 ];
+    for var!(i) in &x {
+        assert_eq!(*i, 3);
+    }
+}