2018-07-19 23:14:00 -07:00
|
|
|
// ignore-tidy-tab
|
|
|
|
|
2016-11-10 12:48:55 -08:00
|
|
|
fn main() {
|
|
|
|
println!("{");
|
2018-07-14 20:50:30 -07:00
|
|
|
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
2016-11-10 12:48:55 -08:00
|
|
|
println!("{{}}");
|
|
|
|
println!("}");
|
2018-07-14 20:50:30 -07:00
|
|
|
//~^ ERROR invalid format string: unmatched `}` found
|
2018-05-10 09:09:58 -07:00
|
|
|
let _ = format!("{_}", _ = 6usize);
|
|
|
|
//~^ ERROR invalid format string: invalid argument name `_`
|
2019-11-28 10:49:13 -08:00
|
|
|
let _ = format!("{a:_}", a = "", _ = 0);
|
|
|
|
//~^ ERROR invalid format string: invalid argument name `_`
|
|
|
|
let _ = format!("{a:._$}", a = "", _ = 0);
|
|
|
|
//~^ ERROR invalid format string: invalid argument name `_`
|
2018-05-10 09:09:58 -07:00
|
|
|
let _ = format!("{");
|
|
|
|
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
|
|
|
let _ = format!("}");
|
|
|
|
//~^ ERROR invalid format string: unmatched `}` found
|
|
|
|
let _ = format!("{\\}");
|
2023-04-28 11:56:02 +00:00
|
|
|
//~^ ERROR invalid format string: expected `'}'`, found `'\'`
|
2018-07-19 23:14:00 -07:00
|
|
|
let _ = format!("\n\n\n{\n\n\n");
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
let _ = format!(r###"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{"###);
|
|
|
|
//~^ ERROR invalid format string
|
|
|
|
let _ = format!(r###"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"###);
|
2018-12-20 22:33:16 -08:00
|
|
|
//~^ ERROR invalid format string
|
2018-07-19 23:14:00 -07:00
|
|
|
let _ = format!(r###"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
"###);
|
|
|
|
//~^^^ ERROR invalid format string
|
|
|
|
let _ = format!(r###"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
"###);
|
|
|
|
//~^^^ ERROR invalid format string: unmatched `}` found
|
2019-10-23 17:32:33 -07:00
|
|
|
println!("{} {} {}", 1, 2);
|
|
|
|
//~^ ERROR 3 positional arguments in format string, but there are 2 arguments
|
2016-11-10 12:48:55 -08:00
|
|
|
}
|