about summary refs log tree commit diff
path: root/src/test/ui/fmt/format-string-error.stderr
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-125/+0
2022-06-16 fix one more case of trailing spaceklensy-1/+1
2019-11-28Allow any identifier as format arg nameDavid Tolnay-18/+26
Previously: error: invalid format string: invalid argument name `_x` --> src/main.rs:2:16 | 2 | println!("{_x}", a=0); | ^^ invalid argument name in format string | = note: argument names cannot start with an underscore Not supporting identifiers starting with underscore appears to have been an arbitrary limitation from 2013 in code that was most likely never reviewed: https://github.com/rust-lang/rust/pull/8245/files#diff-0347868ef389c805e97636623e4a4ea6R277 The error message was dutifully improved in #50610 but is there any reason that leading underscore would be a special case? This commit updates the format_args parser to accept identifiers with leading underscores.
2019-10-23Tweak format string error to point at arguments alwaysEsteban Küber-1/+7
Add secondary span labels with no text to make it clear when there's a mismatch bewteen the positional arguments in a format string and the arguments to the macro. This shouldn't affect experienced users, but it should make it easier for newcomers to more clearly understand how `format!()` and `println!()` are supposed to be used. ``` error: 2 positional arguments in format string, but there is 1 argument --> file8.rs:2:14 | 2 | format!("{} {}", 1); | ^^ ^^ - ``` instead of ``` error: 2 positional arguments in format string, but there is 1 argument --> file8.rs:2:14 | 2 | format!("{} {}", 1); | ^^ ^^ ```
2019-03-25compiletest: make path normalization smarterAndy Russell-3/+3
2018-12-26Various changes to string format diagnosticsEsteban Küber-7/+22
- Point at opening mismatched formatting brace - Account for differences between raw and regular strings - Account for differences between the code snippet and `InternedString` - Add more tests
2018-12-25Remove licensesMark Rousskov-12/+12
2018-07-19Use correct spans for format string errorsEsteban Küber-8/+48
When encountering format string errors in a raw string, or regular string literal with embedded newlines, account for the positional change to use correct spans. :drive by fix: 🚗
2018-07-19Improve suggestion for missing fmt str in printlnEsteban Küber-11/+9
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal.
2018-05-10Improve format string errorsEsteban Küber-3/+41
- Point at format string position inside the formatting string - Explain that argument names can't start with an underscore
2018-02-26Update UI testsVadim Petrochenkov-2/+2
2017-11-26mention nightly in -Z external-macro-backtrace noteAlex Burka-2/+2
2017-11-20address review commentsAlex Burka-2/+2
2017-11-19use -Z flag instead of env varAlex Burka-2/+2
2017-11-19update UI testsAlex Burka-2/+2
2017-07-02Revert "Change error count messages"Ariel Ben-Yehuda-1/+1
This reverts commit 5558c64f33446225739c1153b43d2e309bb4f50e.
2017-05-24Change error count messagesMichael Kohl-1/+1
See #33525 for details.
2016-11-11On fmt string with unescaped `{` note how to escapeEsteban Küber-0/+20
On cases of malformed format strings where a `{` hasn't been properly escaped, like `println!("{");`, present a note explaining how to escape the `{` char.