2018-12-21 00:33:16 -06:00
|
|
|
// ignore-tidy-tab
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
format!("{
|
|
|
|
a");
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
format!("{ \
|
2021-07-31 16:09:19 -05:00
|
|
|
\
|
2018-12-21 00:33:16 -06:00
|
|
|
b");
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
format!(r#"{ \
|
|
|
|
|
|
|
|
rawc"#);
|
|
|
|
//~^^^ ERROR invalid format string
|
|
|
|
format!(r#"{ \n
|
|
|
|
\n
|
|
|
|
rawd"#);
|
|
|
|
//~^^^ ERROR invalid format string
|
|
|
|
format!("{ \n
|
|
|
|
\n
|
|
|
|
e");
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
format!("
|
|
|
|
{
|
|
|
|
a");
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
format!("
|
|
|
|
{
|
|
|
|
a
|
|
|
|
");
|
|
|
|
//~^^ ERROR invalid format string
|
|
|
|
format!(" \
|
|
|
|
{ \
|
|
|
|
\
|
|
|
|
b");
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
format!(" \
|
|
|
|
{ \
|
|
|
|
\
|
|
|
|
b \
|
2021-07-31 16:09:19 -05:00
|
|
|
\
|
2018-12-21 00:33:16 -06:00
|
|
|
");
|
|
|
|
//~^^^ ERROR invalid format string
|
|
|
|
format!(r#"
|
|
|
|
raw { \
|
2021-07-31 16:09:19 -05:00
|
|
|
\
|
2018-12-21 00:33:16 -06:00
|
|
|
c"#);
|
|
|
|
//~^^^ ERROR invalid format string
|
|
|
|
format!(r#"
|
|
|
|
raw { \n
|
|
|
|
\n
|
|
|
|
d"#);
|
|
|
|
//~^^^ ERROR invalid format string
|
|
|
|
format!("
|
|
|
|
{ \n
|
|
|
|
\n
|
|
|
|
e");
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
|
|
|
|
format!("
|
|
|
|
{asdf
|
|
|
|
}
|
|
|
|
", asdf=1);
|
|
|
|
// ok - this is supported
|
|
|
|
format!("
|
|
|
|
{
|
|
|
|
asdf}
|
|
|
|
", asdf=1);
|
|
|
|
//~^^ ERROR invalid format string
|
2018-12-26 22:05:56 -06:00
|
|
|
println!("\t{}");
|
|
|
|
//~^ ERROR 1 positional argument in format string
|
2018-12-27 12:40:06 -06:00
|
|
|
|
|
|
|
// note: `\x7B` is `{`
|
|
|
|
println!("\x7B}\u{8} {", 1);
|
|
|
|
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
|
|
|
|
|
|
|
println!("\x7B}\u8 {", 1);
|
|
|
|
//~^ ERROR incorrect unicode escape sequence
|
|
|
|
|
|
|
|
// note: raw strings don't escape `\xFF` and `\u{FF}` sequences
|
|
|
|
println!(r#"\x7B}\u{8} {"#, 1);
|
|
|
|
//~^ ERROR invalid format string: unmatched `}` found
|
|
|
|
|
|
|
|
println!(r#"\x7B}\u8 {"#, 1);
|
|
|
|
//~^ ERROR invalid format string: unmatched `}` found
|
2018-12-21 00:33:16 -06:00
|
|
|
}
|