about summary refs log tree commit diff
path: root/src/test/ui/macros/format-foreign.rs
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-17/+0
2018-12-25Remove licensesMark Rousskov-10/+0
2018-07-31Use suggestions for shell format argumentsEsteban Küber-0/+2
2018-07-24Use suggestions for `printf` formatEsteban Küber-0/+5
2018-01-15Point at unused arguments for format stringEsteban Küber-1/+1
Avoid overlapping spans by only pointing at the arguments that are not being used in the argument string. Enable libsyntax to have diagnostics with multiple primary spans by accepting `Into<MultiSpan>` instead of `Span`.
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-3/+3
2016-11-11Add foreign formatting directive detection.Daniel Keep-0/+20
This teaches `format_args!` how to interpret format printf- and shell-style format directives. This is used in cases where there are unused formatting arguments, and the reason for that *might* be because the programmer is trying to use the wrong kind of formatting string. This was prompted by an issue encountered by simulacrum on the #rust IRC channel. In short: although `println!` told them that they weren't using all of the conversion arguments, the problem was in using printf-syle directives rather than ones `println!` would undertand. Where possible, `format_args!` will tell the programmer what they should use instead. For example, it will suggest replacing `%05d` with `{:0>5}`, or `%2$.*3$s` with `{1:.3$}`. Even if it cannot suggest a replacement, it will explicitly note that Rust does not support that style of directive, and direct the user to the `std::fmt` documentation.