about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCassaundra Smith <cass@cassaundra.org>2022-11-21 20:36:11 -0800
committerCassaundra Smith <cass@cassaundra.org>2022-11-21 20:37:09 -0800
commit35c7939ae5d3a0e34963bbd57bbc4b91c3ce0ce3 (patch)
tree8230e72c4a6f3a73810de1175b393a79120162b1 /src
parent83356b78c4ff3e7d84e977aa6143793545967301 (diff)
downloadrust-35c7939ae5d3a0e34963bbd57bbc4b91c3ce0ce3.tar.gz
rust-35c7939ae5d3a0e34963bbd57bbc4b91c3ce0ce3.zip
Fix incorrect span when using byte-escaped rbrace
Fix #103826.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/fmt/issue-103826.rs8
-rw-r--r--src/test/ui/fmt/issue-103826.stderr20
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/fmt/issue-103826.rs b/src/test/ui/fmt/issue-103826.rs
new file mode 100644
index 00000000000..a11ec37a06d
--- /dev/null
+++ b/src/test/ui/fmt/issue-103826.rs
@@ -0,0 +1,8 @@
+fn main() {
+    format!("{\x7D");
+    //~^ ERROR 1 positional argument in format string, but no arguments were given
+    format!("\x7B\x7D");
+    //~^ ERROR 1 positional argument in format string, but no arguments were given
+    format!("{\x7D {\x7D");
+    //~^ ERROR 2 positional arguments in format string, but no arguments were given
+}
diff --git a/src/test/ui/fmt/issue-103826.stderr b/src/test/ui/fmt/issue-103826.stderr
new file mode 100644
index 00000000000..0f27e1930bc
--- /dev/null
+++ b/src/test/ui/fmt/issue-103826.stderr
@@ -0,0 +1,20 @@
+error: 1 positional argument in format string, but no arguments were given
+  --> $DIR/issue-103826.rs:2:14
+   |
+LL |     format!("{\x7D");
+   |              ^^^^^
+
+error: 1 positional argument in format string, but no arguments were given
+  --> $DIR/issue-103826.rs:4:14
+   |
+LL |     format!("\x7B\x7D");
+   |              ^^^^^^^^
+
+error: 2 positional arguments in format string, but no arguments were given
+  --> $DIR/issue-103826.rs:6:14
+   |
+LL |     format!("{\x7D {\x7D");
+   |              ^^^^^ ^^^^^
+
+error: aborting due to 3 previous errors
+