summaryrefslogtreecommitdiffstats
path: root/src/test/ui/fmt/format-concat-span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/fmt/format-concat-span.rs')
-rw-r--r--src/test/ui/fmt/format-concat-span.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/fmt/format-concat-span.rs b/src/test/ui/fmt/format-concat-span.rs
new file mode 100644
index 000000000..ce92df0ad
--- /dev/null
+++ b/src/test/ui/fmt/format-concat-span.rs
@@ -0,0 +1,15 @@
+// If the format string is another macro invocation, rustc would previously
+// compute nonsensical spans, such as:
+//
+// error: invalid format string: unmatched `}` found
+// --> test.rs:2:17
+// |
+// 2 | format!(concat!("abc}"));
+// | ^ unmatched `}` in format string
+//
+// This test checks that this behavior has been fixed.
+
+fn main() {
+ format!(concat!("abc}"));
+ //~^ ERROR: invalid format string: unmatched `}` found
+}