about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorwuaoxiang <os.popen@gmail.com>2024-05-18 01:05:56 +0000
committerwuaoxiang <os.popen@gmail.com>2024-05-18 01:05:56 +0000
commit582fd1fb539ddea199dbc238946b00465a20620e (patch)
treeafa94cf42742eb79a3fc5eaf9761b0e1cbcc0ded /tests
parentbe7549f82c194c7a5dc8f34ed0541bfebbaf33ea (diff)
Fix println! ICE when parsing percent prefix number
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/macros/println-percent-prefix-num-issue-125002.rs6
-rw-r--r--tests/ui/macros/println-percent-prefix-num-issue-125002.stderr28
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/macros/println-percent-prefix-num-issue-125002.rs b/tests/ui/macros/println-percent-prefix-num-issue-125002.rs
new file mode 100644
index 00000000000..9f30d48a5cd
--- /dev/null
+++ b/tests/ui/macros/println-percent-prefix-num-issue-125002.rs
@@ -0,0 +1,6 @@
+fn main() {
+    println!("%100000", 1);
+    //~^ ERROR argument never used
+    println!("%     65536", 1);
+    //~^ ERROR argument never used
+}
diff --git a/tests/ui/macros/println-percent-prefix-num-issue-125002.stderr b/tests/ui/macros/println-percent-prefix-num-issue-125002.stderr
new file mode 100644
index 00000000000..7575137be6d
--- /dev/null
+++ b/tests/ui/macros/println-percent-prefix-num-issue-125002.stderr
@@ -0,0 +1,28 @@
+error: argument never used
+  --> $DIR/println-percent-prefix-num-issue-125002.rs:2:25
+   |
+LL |     println!("%100000", 1);
+   |                         ^ argument never used
+   |
+note: format specifiers use curly braces, and the conversion specifier `1` is unknown or unsupported
+  --> $DIR/println-percent-prefix-num-issue-125002.rs:2:15
+   |
+LL |     println!("%100000", 1);
+   |               ^^
+   = note: printf formatting is not supported; see the documentation for `std::fmt`
+
+error: argument never used
+  --> $DIR/println-percent-prefix-num-issue-125002.rs:4:29
+   |
+LL |     println!("%     65536", 1);
+   |                             ^ argument never used
+   |
+note: format specifiers use curly braces, and the conversion specifier ` ` is unknown or unsupported
+  --> $DIR/println-percent-prefix-num-issue-125002.rs:4:15
+   |
+LL |     println!("%     65536", 1);
+   |               ^^
+   = note: printf formatting is not supported; see the documentation for `std::fmt`
+
+error: aborting due to 2 previous errors
+