1
Fork 0

On fmt string with unescaped { note how to escape

On cases of malformed format strings where a `{` hasn't been properly
escaped, like `println!("{");`, present a note explaining how to escape
the `{` char.
This commit is contained in:
Esteban Küber 2016-11-10 12:48:55 -08:00
parent da2ce22768
commit 3c17abc4d9
4 changed files with 61 additions and 6 deletions

View file

@ -0,0 +1,20 @@
error: invalid format string: expected `'}'` but string was terminated
--> $DIR/format-string-error.rs:12:5
|
12 | println!("{");
| ^^^^^^^^^^^^^^
|
= note: if you intended to print `{`, you can escape it using `{{`
= note: this error originates in a macro outside of the current crate
error: invalid format string: unmatched `}` found
--> $DIR/format-string-error.rs:14:5
|
14 | println!("}");
| ^^^^^^^^^^^^^^
|
= note: if you intended to print `}`, you can escape it using `}}`
= note: this error originates in a macro outside of the current crate
error: aborting due to 2 previous errors