Skip to content

Commit fb2d530

Browse files
committed
Add test for format args capture bug.
1 parent 9b8e4c6 commit fb2d530

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn main() {
2+
let a = "a";
3+
let b = "b";
4+
5+
println!("{a} {b} {} {} {c} {}", c = "c");
6+
//~^ ERROR: invalid reference to positional arguments 1 and 2 (there is 1 argument)
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: invalid reference to positional arguments 1 and 2 (there is 1 argument)
2+
--> $DIR/format-args-capture-issue-93378.rs:5:26
3+
|
4+
LL | println!("{a} {b} {} {} {c} {}", c = "c");
5+
| ^^ ^^
6+
|
7+
= note: positional arguments are zero-based
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)