about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2014-10-01 11:38:54 +0200
committerFlorian Hahn <flo@fhahn.com>2014-10-01 11:46:04 +0200
commit49e976d771d9a3282bb0f58f28e5e92d10c2e4c6 (patch)
tree26080db909dc531efc47abbcbc0efe10ec7aef12 /src/test
parent60e7317345f246a8169bbfe721473f693d54cade (diff)
downloadrust-49e976d771d9a3282bb0f58f28e5e92d10c2e4c6.tar.gz
rust-49e976d771d9a3282bb0f58f28e5e92d10c2e4c6.zip
Limit recursion depth for macro expansions, closes #17628
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/infinite-macro-expansion.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/compile-fail/infinite-macro-expansion.rs b/src/test/compile-fail/infinite-macro-expansion.rs
new file mode 100644
index 00000000000..3ea5671735d
--- /dev/null
+++ b/src/test/compile-fail/infinite-macro-expansion.rs
@@ -0,0 +1,22 @@
+// Copyright 2014 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.
+
+#![feature(macro_rules)]
+
+macro_rules! recursive(
+      () => (
+                recursive!() //~ ERROR Recursion limit reached while expanding the macro `recursive`
+              )
+      )
+
+fn main() {
+    recursive!()
+}
+