diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-03 00:09:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-03 00:09:06 +0200 |
| commit | edc846f29eac8a45555f19a9fd951ed414398776 (patch) | |
| tree | 0be1fc6ac0861dd9dcb59c83e9327e7b657c20ac /src/libsyntax/parse | |
| parent | a2735a3e0dd58e4b41b933731928678b7a2da700 (diff) | |
| parent | 22ea38dd792ec9983084a101ca6159999a9b851a (diff) | |
| download | rust-edc846f29eac8a45555f19a9fd951ed414398776.tar.gz rust-edc846f29eac8a45555f19a9fd951ed414398776.zip | |
Rollup merge of #63121 - estebank:formatting-pos, r=alexcrichton
On `format!()` arg count mismatch provide extra info
When positional width and precision formatting flags are present in a
formatting string that has an argument count mismatch, provide extra
information pointing at them making it easiser to understand where the
problem may lay:
```
error: 4 positional arguments in format string, but there are 3 arguments
--> $DIR/ifmt-bad-arg.rs:78:15
|
LL | println!("{} {:.*} {}", 1, 3.2, 4);
| ^^ ^^--^ ^^ --- this parameter corresponds to the precision flag
| |
| this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: 4 positional arguments in format string, but there are 3 arguments
--> $DIR/ifmt-bad-arg.rs:81:15
|
LL | println!("{} {:07$.*} {}", 1, 3.2, 4);
| ^^ ^^-----^ ^^ --- this parameter corresponds to the precision flag
| | |
| | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
| this width flag expects an `usize` argument at position 7, but there are 3 arguments
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: invalid reference to positional argument 7 (there are 3 arguments)
--> $DIR/ifmt-bad-arg.rs:84:18
|
LL | println!("{} {:07$} {}", 1, 3.2, 4);
| ^^^--^
| |
| this width flag expects an `usize` argument at position 7, but there are 3 arguments
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
```
Fix #49384.
Diffstat (limited to 'src/libsyntax/parse')
0 files changed, 0 insertions, 0 deletions
