summary refs log tree commit diff
path: root/src/test/ui/fmt
AgeCommit message (Collapse)AuthorLines
2019-11-28Allow any identifier as format arg nameDavid Tolnay-20/+30
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/+9
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-09-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-2/+2
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-10/+6
2019-05-31fix tidyEsteban Küber-19/+18
2019-05-30Remove unecessary `-Z continue-parse-after-error` from testsEsteban Küber-1/+1
2019-05-02don't amplify errors in format! with bad literalsAleksey Kladov-14/+3
2019-05-02introduce unescape moduleAleksey Kladov-26/+29
Currently, we deal with escape sequences twice: once when we lex a string, and a second time when we unescape literals. This PR aims to remove this duplication, by introducing a new `unescape` mode as a single source of truth for character escaping rules
2019-03-25compiletest: make path normalization smarterAndy Russell-28/+28
2019-03-11Update testsVadim Petrochenkov-2/+2
2018-12-31Use structured suggestion for braceless unicode escape squenceEsteban Küber-7/+3
2018-12-31Account for `\xFF` and `\u{FF}` sequences in string format errorsEsteban Küber-1/+62
2018-12-26Point at correct span for arguments in format stringsEsteban Küber-1/+9
When a format string has escaped whitespace characters format arguments were shifted by one per each escaped character. Account for these escaped characters when synthesizing the spans. Fix #55155.
2018-12-26Various changes to string format diagnosticsEsteban Küber-8/+230
- 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-36/+16
2018-07-19Use correct spans for format string errorsEsteban Küber-8/+82
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/+11
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal.
2018-06-23add `dyn` to display of dynamic (trait) type namesZack M. Davis-8/+8
The `dyn Trait` syntax was stabilized in 199ee327. Resolves #49277.
2018-05-10Improve format string errorsEsteban Küber-4/+51
- Point at format string position inside the formatting string - Explain that argument names can't start with an underscore
2018-03-15Auto merge of #48138 - estebank:issue-45092, r=nikomatsakisbors-6/+6
Reword E0044 and message for `!Send` types - Reword E0044 help. - Change error message for types that don't implement `Send` CC #45092, #46678, #24909, #33307.
2018-03-14Reword E0044 and message for `!Send` typesEsteban Küber-6/+6
- Reword E0044 help. - Change error message for types that don't implement `Send`
2018-03-14update testsGuillaume Gomez-1/+1
2018-02-26Update UI testsVadim Petrochenkov-6/+6
2018-02-25Update ui testsGuillaume Gomez-0/+1
2018-01-15On E0283, point at method with the requirementsEsteban Küber-2/+10
On required type annotation diagnostic error, point at method with the requirements if the span is available.
2017-11-26mention nightly in -Z external-macro-backtrace noteAlex Burka-2/+2
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-4/+4
2017-11-22Auto merge of #45198 - oli-obk:fmt_args, r=sfacklerbors-0/+54
Prevent fmt::Arguments from being shared across threads Fixes #45197 This is a **breaking change**! Without doing this it's very easy to create race conditions. There's probably a way to do this without breaking valid use cases, but it would require quite an overhaul of the formatting machinery.
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-10-11Prevent fmt::Arguments from being shared across threadsOliver Schneider-0/+54
Fixes #45197
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/+36
On cases of malformed format strings where a `{` hasn't been properly escaped, like `println!("{");`, present a note explaining how to escape the `{` char.