Add test for format args capture bug.
This commit is contained in:
parent
9b8e4c63de
commit
fb2d530dd2
2 changed files with 17 additions and 0 deletions
7
src/test/ui/fmt/format-args-capture-issue-93378.rs
Normal file
7
src/test/ui/fmt/format-args-capture-issue-93378.rs
Normal 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)
|
||||
}
|
10
src/test/ui/fmt/format-args-capture-issue-93378.stderr
Normal file
10
src/test/ui/fmt/format-args-capture-issue-93378.stderr
Normal 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
|
||||
|
Loading…
Add table
Reference in a new issue