| // ignore-tidy-file-tab | |
| fn main() { | |
| format!("{ | |
| a"); | |
| //~^ ERROR invalid format string | |
| format!("{ \ | |
| \ | |
| 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 \ | |
| \ | |
| "); | |
| //~^^^ ERROR invalid format string | |
| format!(r#" | |
| raw { \ | |
| \ | |
| 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 | |
| println!("\t{}"); | |
| //~^ ERROR 1 positional argument in format string | |
| // 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 | |
| println!("{x?}, world!",); | |
| //~^ ERROR invalid format string: expected `}`, found `?` | |
| println!("{x,}, world!",); | |
| //~^ ERROR invalid format string: python's numeric grouping `,` is not supported in rust format strings | |
| println!("{x=}"); | |
| //~^ ERROR invalid format string: python's f-string debug `=` is not supported in rust, use `dbg(x)` instead | |
| println!( | |
| "fn main() {\n\ | |
| \n\ | |
| }" | |
| //~^^^ ERROR 1 positional argument in format string | |
| ); | |
| // Don't emit note suggesting an escaping `{` for `{ }`. | |
| println!("{ }"); | |
| //~^ ERROR 1 positional argument in format string | |
| } |