summary refs log tree commit diff
path: root/compiler/rustc_parse_format/src
AgeCommit message (Collapse)AuthorLines
2022-10-01Detect and reject out-of-range integers in format string literalsColin Baumgarten-4/+39
Until now out-of-range integers in format string literals were silently ignored. They wrapped around to zero at usize::MAX, producing unexpected results. When using debug builds of rustc, such integers in format string literals even cause an 'attempt to add with overflow' panic in rustc. Fix this by producing an error diagnostic for integers in format string literals which do not fit into usize. Fixes #102528
2022-09-28Fix span of byte-escaped left format args braceCassaundra Smith-1/+1
Fix #102057.
2022-08-25Separate CountIsStar from CountIsParam in rustc_parse_format.Mara Bos-2/+4
2022-08-21Fix rustc_parse_format precision & width spansAlex Macleod-54/+68
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-04add a comment about what we can parse nowTakayuki Maeda-0/+2
2022-08-04return when captured argument is not a struct fieldTakayuki Maeda-13/+12
2022-08-03suggest a positional formatting argument instead of a captured argumentTakayuki Maeda-7/+41
2022-07-31Always include a position span in rustc_parse_format::ArgumentAlex Macleod-29/+81
2022-07-25Generate correct suggestion with named arguments used positionallyPreston From-12/+36
Address issue #99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue #99265 also fixes issue #99266. Fixes #99265 Fixes #99266
2022-07-20Add diagnostic width span when '0$' is used as width.miam-miam100-1/+19
2022-05-03Make rustc_parse_format compile on stablebjorn3-103/+113
This allows it to be used by lightweight formatting systems and may allow it to be used by rust-analyzer.
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-02-16Correctly mark the span of captured arguments in `format_args!()`Chayim Refael Friedman-8/+12
It should only include the identifier, or misspelling suggestions will be wrong.
2021-07-08Rework SESSION_GLOBALS API to prevent overwriting itGuillaume Gomez-2/+1
2021-05-24remove cfg(bootstrap)Pietro Albini-1/+0
2021-03-28Rollup merge of #83348 - osa1:issue83344, r=jackh726Yuki Okushi-4/+6
format macro argument parsing fix When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344 --- r? ```@estebank```
2021-03-27format macro argument parsing fixÖmer Sinan Ağacan-4/+6
When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344
2021-03-27Rollup merge of #83343 - osa1:issue83340, r=jackh726Yuki Okushi-14/+9
Simplify and fix byte skipping in format! string parser Fixes '\\' handling in format strings. Fixes #83340
2021-03-21Simplify and fix byte skipping in format! string parserÖmer Sinan Ağacan-14/+9
Fixes '\\' handling in format strings. Fixes #83340
2021-03-19stabilize or_patternsmark-1/+1
2021-02-06parse_format: treat r" as a literalDavid Hewitt-1/+1
2021-01-17rustc_parse_format: Fix character indices in find_skipsÖmer Sinan Ağacan-1/+1
Fixes #81006
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-2/+2
2020-09-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-21Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPCecstatic-morse-6/+3
use if let instead of single match arm expressions use if let instead of single match arm expressions to compact code and reduce nesting (clippy::single_match)
2020-09-20use if let instead of single match arm expressions to compact code and ↵Matthias Krüger-6/+3
reduce nesting (clippy::single_match)
2020-09-17Remove redundant #![feature(...)] 's from compiler/est31-2/+0
2020-08-30mv compiler to compiler/mark-0/+1125