about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDouglas Young <rcxdude@gmail.com>2014-02-18 16:14:12 +0000
committerDouglas Young <rcxdude@gmail.com>2014-02-18 16:17:51 +0000
commit0bdfd0f4c76fa29a4be774937bc72165390b06d6 (patch)
treee595de26e0a25bd8b8258a82ef653553c499d42e /src/test
parent517e38997db9f60612676c9f83dab6ed35c1b5df (diff)
downloadrust-0bdfd0f4c76fa29a4be774937bc72165390b06d6.tar.gz
rust-0bdfd0f4c76fa29a4be774937bc72165390b06d6.zip
Avoid returning original macro if expansion fails.
Closes #11692. Instead of returning the original expression, a dummy expression
(with identical span) is returned. This prevents infinite loops of failed
expansions as well as odd double error messages in certain situations.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-11692.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-11692.rs b/src/test/compile-fail/issue-11692.rs
new file mode 100644
index 00000000000..aed2c4d579a
--- /dev/null
+++ b/src/test/compile-fail/issue-11692.rs
@@ -0,0 +1,19 @@
+// 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.
+
+fn main() {
+    print!(test!());
+    //~^ ERROR: macro undefined: 'test'
+    //~^^ ERROR: format argument must be a string literal
+
+    concat!(test!());
+    //~^ ERROR: macro undefined: 'test'
+    //~^^ ERROR: expected a literal
+}