]> git.lizzy.rs Git - rust.git/commit
Point at formatting descriptor string when it is invalid
authorEsteban Küber <esteban@kuber.com.ar>
Tue, 5 Nov 2019 19:55:00 +0000 (11:55 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Tue, 5 Nov 2019 22:06:38 +0000 (14:06 -0800)
commit08b235b5bed1a53311da34fa12966cd42a2a5abe
tree2cbd042c2d9d566b1bc6d62d7b5d02e255d21b17
parent3a1b3b30c6cdd674049b144a3ced7b711de962b2
Point at formatting descriptor string when it is invalid

When a formatting string contains an invalid descriptor, point at it
instead of the argument:

```
error: unknown format trait `foo`
  --> $DIR/ifmt-bad-arg.rs:86:17
   |
LL |     println!("{:foo}", 1);
   |                 ^^^
   |
   = note: the only appropriate formatting traits are:
           - ``, which uses the `Display` trait
           - `?`, which uses the `Debug` trait
           - `e`, which uses the `LowerExp` trait
           - `E`, which uses the `UpperExp` trait
           - `o`, which uses the `Octal` trait
           - `p`, which uses the `Pointer` trait
           - `b`, which uses the `Binary` trait
           - `x`, which uses the `LowerHex` trait
           - `X`, which uses the `UpperHex` trait
```
src/libfmt_macros/lib.rs
src/libsyntax_ext/format.rs
src/test/ui/if/ifmt-bad-arg.stderr
src/test/ui/if/ifmt-unknown-trait.stderr