about summary refs log tree commit diff
path: root/tests/ui/macros/for-loop-macro-rules-hygiene.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/macros/for-loop-macro-rules-hygiene.rs')
-rw-r--r--tests/ui/macros/for-loop-macro-rules-hygiene.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/macros/for-loop-macro-rules-hygiene.rs b/tests/ui/macros/for-loop-macro-rules-hygiene.rs
new file mode 100644
index 00000000000..fcebda1b9da
--- /dev/null
+++ b/tests/ui/macros/for-loop-macro-rules-hygiene.rs
@@ -0,0 +1,12 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/15189
+
+//@ run-pass
+macro_rules! third {
+    ($e:expr) => ({let x = 2; $e[x]})
+}
+
+fn main() {
+    let x = vec![10_usize,11_usize,12_usize,13_usize];
+    let t = third!(x);
+    assert_eq!(t,12_usize);
+}