Add test for format args capture bug.

This commit is contained in:
Mara Bos 2022-01-27 23:51:11 +01:00
parent 9b8e4c63de
commit fb2d530dd2
2 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,7 @@
fn main() {
let a = "a";
let b = "b";
println!("{a} {b} {} {} {c} {}", c = "c");
//~^ ERROR: invalid reference to positional arguments 1 and 2 (there is 1 argument)
}

View file

@ -0,0 +1,10 @@
error: invalid reference to positional arguments 1 and 2 (there is 1 argument)
--> $DIR/format-args-capture-issue-93378.rs:5:26
|
LL | println!("{a} {b} {} {} {c} {}", c = "c");
| ^^ ^^
|
= note: positional arguments are zero-based
error: aborting due to previous error