mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 14:23:45 +00:00
Remove 'apostrophes'
from rustc_parse_format
This commit is contained in:
parent
9322d183f4
commit
dda3066805
@ -7,7 +7,7 @@ edition = "2021"
|
|||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
syn = { version = "2.0.9", features = ["full"] }
|
syn = { version = "2.0.9", features = ["full", "extra-traits"] }
|
||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
quote = "1"
|
quote = "1"
|
||||||
|
|
||||||
|
@ -473,19 +473,19 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = peek_pos;
|
pos = peek_pos;
|
||||||
description = format!("expected `'}}'`, found `{maybe:?}`");
|
description = format!("expected `}}`, found `{}`", maybe.escape_debug());
|
||||||
} else {
|
} else {
|
||||||
description = "expected `'}'` but string was terminated".to_owned();
|
description = "expected `}` but string was terminated".to_owned();
|
||||||
// point at closing `"`
|
// point at closing `"`
|
||||||
pos = self.input.len() - if self.append_newline { 1 } else { 0 };
|
pos = self.input.len() - if self.append_newline { 1 } else { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
let pos = self.to_span_index(pos);
|
let pos = self.to_span_index(pos);
|
||||||
|
|
||||||
let label = "expected `'}'`".to_owned();
|
let label = "expected `}`".to_owned();
|
||||||
let (note, secondary_label) = if arg.format.fill == Some('}') {
|
let (note, secondary_label) = if arg.format.fill == Some('}') {
|
||||||
(
|
(
|
||||||
Some("the character `'}'` is interpreted as a fill character because of the `:` that precedes it".to_owned()),
|
Some("the character `}` is interpreted as a fill character because of the `:` that precedes it".to_owned()),
|
||||||
arg.format.fill_span.map(|sp| ("this is not interpreted as a formatting closing brace".to_owned(), sp)),
|
arg.format.fill_span.map(|sp| ("this is not interpreted as a formatting closing brace".to_owned(), sp)),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -178,7 +178,7 @@ struct ErrorWithNonexistentField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
//~^ ERROR invalid format string: expected `'}'`
|
//~^ ERROR invalid format string: expected `}`
|
||||||
#[diag(no_crate_example, code = E0123)]
|
#[diag(no_crate_example, code = E0123)]
|
||||||
struct ErrorMissingClosingBrace {
|
struct ErrorMissingClosingBrace {
|
||||||
#[suggestion(no_crate_suggestion, code = "{name")]
|
#[suggestion(no_crate_suggestion, code = "{name")]
|
||||||
|
@ -184,11 +184,11 @@ error: `name` doesn't refer to a field on this type
|
|||||||
LL | #[suggestion(no_crate_suggestion, code = "{name}")]
|
LL | #[suggestion(no_crate_suggestion, code = "{name}")]
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/diagnostic-derive.rs:180:10
|
--> $DIR/diagnostic-derive.rs:180:10
|
||||||
|
|
|
|
||||||
LL | #[derive(Diagnostic)]
|
LL | #[derive(Diagnostic)]
|
||||||
| ^^^^^^^^^^ expected `'}'` in format string
|
| ^^^^^^^^^^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
@ -19,8 +19,8 @@ trait ImportantTrait3 {}
|
|||||||
trait ImportantTrait4 {}
|
trait ImportantTrait4 {}
|
||||||
|
|
||||||
#[diagnostic::on_unimplemented(message = "Test {Self:!}")]
|
#[diagnostic::on_unimplemented(message = "Test {Self:!}")]
|
||||||
//~^WARN expected `'}'`, found `'!'`
|
//~^WARN expected `}`, found `!`
|
||||||
//~|WARN expected `'}'`, found `'!'`
|
//~|WARN expected `}`, found `!`
|
||||||
//~|WARN unmatched `}` found
|
//~|WARN unmatched `}` found
|
||||||
//~|WARN unmatched `}` found
|
//~|WARN unmatched `}` found
|
||||||
trait ImportantTrait5 {}
|
trait ImportantTrait5 {}
|
||||||
|
@ -30,7 +30,7 @@ LL | #[diagnostic::on_unimplemented(message = "Test {Self:123}")]
|
|||||||
|
|
|
|
||||||
= help: no format specifier are supported in this position
|
= help: no format specifier are supported in this position
|
||||||
|
|
||||||
warning: expected `'}'`, found `'!'`
|
warning: expected `}`, found `!`
|
||||||
--> $DIR/broken_format.rs:21:32
|
--> $DIR/broken_format.rs:21:32
|
||||||
|
|
|
|
||||||
LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
|
LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
|
||||||
@ -153,7 +153,7 @@ note: required by a bound in `check_4`
|
|||||||
LL | fn check_4(_: impl ImportantTrait4) {}
|
LL | fn check_4(_: impl ImportantTrait4) {}
|
||||||
| ^^^^^^^^^^^^^^^ required by this bound in `check_4`
|
| ^^^^^^^^^^^^^^^ required by this bound in `check_4`
|
||||||
|
|
||||||
warning: expected `'}'`, found `'!'`
|
warning: expected `}`, found `!`
|
||||||
--> $DIR/broken_format.rs:21:32
|
--> $DIR/broken_format.rs:21:32
|
||||||
|
|
|
|
||||||
LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
|
LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world! {0:}<3", 2);
|
println!("Hello, world! {0:}<3", 2);
|
||||||
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
//~^ ERROR invalid format string: expected `}` but string was terminated
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/closing-brace-as-fill.rs:6:35
|
--> $DIR/closing-brace-as-fill.rs:6:35
|
||||||
|
|
|
|
||||||
LL | println!("Hello, world! {0:}<3", 2);
|
LL | println!("Hello, world! {0:}<3", 2);
|
||||||
| - ^ expected `'}'` in format string
|
| - ^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| this is not interpreted as a formatting closing brace
|
| this is not interpreted as a formatting closing brace
|
||||||
|
|
|
|
||||||
= note: the character `'}'` is interpreted as a fill character because of the `:` that precedes it
|
= note: the character `}` is interpreted as a fill character because of the `:` that precedes it
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ raw { \n
|
|||||||
|
|
||||||
// note: `\x7B` is `{`
|
// note: `\x7B` is `{`
|
||||||
println!("\x7B}\u{8} {", 1);
|
println!("\x7B}\u{8} {", 1);
|
||||||
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
//~^ ERROR invalid format string: expected `}` but string was terminated
|
||||||
|
|
||||||
println!("\x7B}\u8 {", 1);
|
println!("\x7B}\u8 {", 1);
|
||||||
//~^ ERROR incorrect unicode escape sequence
|
//~^ ERROR incorrect unicode escape sequence
|
||||||
|
@ -9,138 +9,138 @@ help: format of unicode escape sequences uses braces
|
|||||||
LL | println!("\x7B}\u{8} {", 1);
|
LL | println!("\x7B}\u{8} {", 1);
|
||||||
| ~~~~~
|
| ~~~~~
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'a'`
|
error: invalid format string: expected `}`, found `a`
|
||||||
--> $DIR/format-string-error-2.rs:5:5
|
--> $DIR/format-string-error-2.rs:5:5
|
||||||
|
|
|
|
||||||
LL | format!("{
|
LL | format!("{
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | a");
|
LL | a");
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'b'`
|
error: invalid format string: expected `}`, found `b`
|
||||||
--> $DIR/format-string-error-2.rs:9:5
|
--> $DIR/format-string-error-2.rs:9:5
|
||||||
|
|
|
|
||||||
LL | format!("{ \
|
LL | format!("{ \
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | \
|
LL | \
|
||||||
LL | b");
|
LL | b");
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'\'`
|
error: invalid format string: expected `}`, found `\`
|
||||||
--> $DIR/format-string-error-2.rs:11:18
|
--> $DIR/format-string-error-2.rs:11:18
|
||||||
|
|
|
|
||||||
LL | format!(r#"{ \
|
LL | format!(r#"{ \
|
||||||
| - ^ expected `'}'` in format string
|
| - ^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'\'`
|
error: invalid format string: expected `}`, found `\`
|
||||||
--> $DIR/format-string-error-2.rs:15:18
|
--> $DIR/format-string-error-2.rs:15:18
|
||||||
|
|
|
|
||||||
LL | format!(r#"{ \n
|
LL | format!(r#"{ \n
|
||||||
| - ^ expected `'}'` in format string
|
| - ^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'e'`
|
error: invalid format string: expected `}`, found `e`
|
||||||
--> $DIR/format-string-error-2.rs:21:5
|
--> $DIR/format-string-error-2.rs:21:5
|
||||||
|
|
|
|
||||||
LL | format!("{ \n
|
LL | format!("{ \n
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | \n
|
LL | \n
|
||||||
LL | e");
|
LL | e");
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'a'`
|
error: invalid format string: expected `}`, found `a`
|
||||||
--> $DIR/format-string-error-2.rs:25:5
|
--> $DIR/format-string-error-2.rs:25:5
|
||||||
|
|
|
|
||||||
LL | {
|
LL | {
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | a");
|
LL | a");
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'a'`
|
error: invalid format string: expected `}`, found `a`
|
||||||
--> $DIR/format-string-error-2.rs:29:5
|
--> $DIR/format-string-error-2.rs:29:5
|
||||||
|
|
|
|
||||||
LL | {
|
LL | {
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | a
|
LL | a
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'b'`
|
error: invalid format string: expected `}`, found `b`
|
||||||
--> $DIR/format-string-error-2.rs:35:5
|
--> $DIR/format-string-error-2.rs:35:5
|
||||||
|
|
|
|
||||||
LL | { \
|
LL | { \
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | \
|
LL | \
|
||||||
LL | b");
|
LL | b");
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'b'`
|
error: invalid format string: expected `}`, found `b`
|
||||||
--> $DIR/format-string-error-2.rs:40:5
|
--> $DIR/format-string-error-2.rs:40:5
|
||||||
|
|
|
|
||||||
LL | { \
|
LL | { \
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | \
|
LL | \
|
||||||
LL | b \
|
LL | b \
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'\'`
|
error: invalid format string: expected `}`, found `\`
|
||||||
--> $DIR/format-string-error-2.rs:45:8
|
--> $DIR/format-string-error-2.rs:45:8
|
||||||
|
|
|
|
||||||
LL | raw { \
|
LL | raw { \
|
||||||
| - ^ expected `'}'` in format string
|
| - ^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'\'`
|
error: invalid format string: expected `}`, found `\`
|
||||||
--> $DIR/format-string-error-2.rs:50:8
|
--> $DIR/format-string-error-2.rs:50:8
|
||||||
|
|
|
|
||||||
LL | raw { \n
|
LL | raw { \n
|
||||||
| - ^ expected `'}'` in format string
|
| - ^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'e'`
|
error: invalid format string: expected `}`, found `e`
|
||||||
--> $DIR/format-string-error-2.rs:57:5
|
--> $DIR/format-string-error-2.rs:57:5
|
||||||
|
|
|
|
||||||
LL | { \n
|
LL | { \n
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | \n
|
LL | \n
|
||||||
LL | e");
|
LL | e");
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'a'`
|
error: invalid format string: expected `}`, found `a`
|
||||||
--> $DIR/format-string-error-2.rs:67:5
|
--> $DIR/format-string-error-2.rs:67:5
|
||||||
|
|
|
|
||||||
LL | {
|
LL | {
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | asdf}
|
LL | asdf}
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
@ -150,11 +150,11 @@ error: 1 positional argument in format string, but no arguments were given
|
|||||||
LL | println!("\t{}");
|
LL | println!("\t{}");
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/format-string-error-2.rs:74:27
|
--> $DIR/format-string-error-2.rs:74:27
|
||||||
|
|
|
|
||||||
LL | println!("\x7B}\u{8} {", 1);
|
LL | println!("\x7B}\u{8} {", 1);
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("{");
|
println!("{");
|
||||||
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
//~^ ERROR invalid format string: expected `}` but string was terminated
|
||||||
println!("{{}}");
|
println!("{{}}");
|
||||||
println!("}");
|
println!("}");
|
||||||
//~^ ERROR invalid format string: unmatched `}` found
|
//~^ ERROR invalid format string: unmatched `}` found
|
||||||
@ -13,11 +13,11 @@ fn main() {
|
|||||||
let _ = format!("{a:._$}", a = "", _ = 0);
|
let _ = format!("{a:._$}", a = "", _ = 0);
|
||||||
//~^ ERROR invalid format string: invalid argument name `_`
|
//~^ ERROR invalid format string: invalid argument name `_`
|
||||||
let _ = format!("{");
|
let _ = format!("{");
|
||||||
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
//~^ ERROR invalid format string: expected `}` but string was terminated
|
||||||
let _ = format!("}");
|
let _ = format!("}");
|
||||||
//~^ ERROR invalid format string: unmatched `}` found
|
//~^ ERROR invalid format string: unmatched `}` found
|
||||||
let _ = format!("{\\}");
|
let _ = format!("{\\}");
|
||||||
//~^ ERROR invalid format string: expected `'}'`, found `'\'`
|
//~^ ERROR invalid format string: expected `}`, found `\`
|
||||||
let _ = format!("\n\n\n{\n\n\n");
|
let _ = format!("\n\n\n{\n\n\n");
|
||||||
//~^ ERROR invalid format string
|
//~^ ERROR invalid format string
|
||||||
let _ = format!(r###"
|
let _ = format!(r###"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/format-string-error.rs:4:16
|
--> $DIR/format-string-error.rs:4:16
|
||||||
|
|
|
|
||||||
LL | println!("{");
|
LL | println!("{");
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
@ -40,11 +40,11 @@ LL | let _ = format!("{a:._$}", a = "", _ = 0);
|
|||||||
|
|
|
|
||||||
= note: argument name cannot be a single underscore
|
= note: argument name cannot be a single underscore
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/format-string-error.rs:15:23
|
--> $DIR/format-string-error.rs:15:23
|
||||||
|
|
|
|
||||||
LL | let _ = format!("{");
|
LL | let _ = format!("{");
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
@ -58,44 +58,44 @@ LL | let _ = format!("}");
|
|||||||
|
|
|
|
||||||
= note: if you intended to print `}`, you can escape it using `}}`
|
= note: if you intended to print `}`, you can escape it using `}}`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'\'`
|
error: invalid format string: expected `}`, found `\`
|
||||||
--> $DIR/format-string-error.rs:19:23
|
--> $DIR/format-string-error.rs:19:23
|
||||||
|
|
|
|
||||||
LL | let _ = format!("{\}");
|
LL | let _ = format!("{\}");
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/format-string-error.rs:21:35
|
--> $DIR/format-string-error.rs:21:35
|
||||||
|
|
|
|
||||||
LL | let _ = format!("\n\n\n{\n\n\n");
|
LL | let _ = format!("\n\n\n{\n\n\n");
|
||||||
| - ^ expected `'}'` in format string
|
| - ^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/format-string-error.rs:27:3
|
--> $DIR/format-string-error.rs:27:3
|
||||||
|
|
|
|
||||||
LL | {"###);
|
LL | {"###);
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/format-string-error.rs:35:1
|
--> $DIR/format-string-error.rs:35:1
|
||||||
|
|
|
|
||||||
LL | {
|
LL | {
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL |
|
LL |
|
||||||
LL | "###);
|
LL | "###);
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ fn main() {
|
|||||||
format!("{?:?}", bar);
|
format!("{?:?}", bar);
|
||||||
//~^ ERROR invalid format string: expected format parameter to occur after `:`
|
//~^ ERROR invalid format string: expected format parameter to occur after `:`
|
||||||
format!("{??}", bar);
|
format!("{??}", bar);
|
||||||
//~^ ERROR invalid format string: expected `'}'`, found `'?'`
|
//~^ ERROR invalid format string: expected `}`, found `?`
|
||||||
format!("{?;bar}");
|
format!("{?;bar}");
|
||||||
//~^ ERROR invalid format string: expected `'}'`, found `'?'`
|
//~^ ERROR invalid format string: expected `}`, found `?`
|
||||||
format!("{?:#?}", bar);
|
format!("{?:#?}", bar);
|
||||||
//~^ ERROR invalid format string: expected format parameter to occur after `:`
|
//~^ ERROR invalid format string: expected format parameter to occur after `:`
|
||||||
format!("Hello {<5:}!", "x");
|
format!("Hello {<5:}!", "x");
|
||||||
|
@ -22,21 +22,21 @@ LL | format!("{?:?}", bar);
|
|||||||
|
|
|
|
||||||
= note: `?` comes after `:`, try `:?` instead
|
= note: `?` comes after `:`, try `:?` instead
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'?'`
|
error: invalid format string: expected `}`, found `?`
|
||||||
--> $DIR/format-string-wrong-order.rs:9:15
|
--> $DIR/format-string-wrong-order.rs:9:15
|
||||||
|
|
|
|
||||||
LL | format!("{??}", bar);
|
LL | format!("{??}", bar);
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'?'`
|
error: invalid format string: expected `}`, found `?`
|
||||||
--> $DIR/format-string-wrong-order.rs:11:15
|
--> $DIR/format-string-wrong-order.rs:11:15
|
||||||
|
|
|
|
||||||
LL | format!("{?;bar}");
|
LL | format!("{?;bar}");
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
|
@ -48,7 +48,7 @@ fn main() {
|
|||||||
|
|
||||||
// bad syntax of the format string
|
// bad syntax of the format string
|
||||||
|
|
||||||
format!("{"); //~ ERROR: expected `'}'` but string was terminated
|
format!("{"); //~ ERROR: expected `}` but string was terminated
|
||||||
|
|
||||||
format!("foo } bar"); //~ ERROR: unmatched `}` found
|
format!("foo } bar"); //~ ERROR: unmatched `}` found
|
||||||
format!("foo }"); //~ ERROR: unmatched `}` found
|
format!("foo }"); //~ ERROR: unmatched `}` found
|
||||||
|
@ -136,11 +136,11 @@ LL | format!("{valuea} {valueb}", valuea=5, valuec=7);
|
|||||||
| |
|
| |
|
||||||
| formatting specifier missing
|
| formatting specifier missing
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/ifmt-bad-arg.rs:51:15
|
--> $DIR/ifmt-bad-arg.rs:51:15
|
||||||
|
|
|
|
||||||
LL | format!("{");
|
LL | format!("{");
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
|
|
|
|
||||||
@ -172,13 +172,13 @@ LL | format!("foo %s baz", "bar");
|
|||||||
|
|
|
|
||||||
= note: printf formatting is not supported; see the documentation for `std::fmt`
|
= note: printf formatting is not supported; see the documentation for `std::fmt`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'`, found `'t'`
|
error: invalid format string: expected `}`, found `t`
|
||||||
--> $DIR/ifmt-bad-arg.rs:75:1
|
--> $DIR/ifmt-bad-arg.rs:75:1
|
||||||
|
|
|
|
||||||
LL | ninth number: {
|
LL | ninth number: {
|
||||||
| - because of this opening brace
|
| - because of this opening brace
|
||||||
LL | tenth number: {}",
|
LL | tenth number: {}",
|
||||||
| ^ expected `'}'` in format string
|
| ^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let _ = format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i);
|
let _ = format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i);
|
||||||
//~^ ERROR: invalid format string: expected `'}'` but string was terminated
|
//~^ ERROR: invalid format string: expected `}` but string was terminated
|
||||||
//~| NOTE: if you intended to print `{`, you can escape it using `{{`
|
//~| NOTE: if you intended to print `{`, you can escape it using `{{`
|
||||||
//~| NOTE: in this expansion of concat!
|
//~| NOTE: in this expansion of concat!
|
||||||
//~| NOTE: in this expansion of concat!
|
//~| NOTE: in this expansion of concat!
|
||||||
//~| NOTE: expected `'}'` in format string
|
//~| NOTE: expected `}` in format string
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/issue-91556.rs:2:19
|
--> $DIR/issue-91556.rs:2:19
|
||||||
|
|
|
|
||||||
LL | let _ = format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i);
|
LL | let _ = format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i);
|
||||||
| ^^^^^^^^^^^^^^^^^^^ expected `'}'` in format string
|
| ^^^^^^^^^^^^^^^^^^^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
= note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
@ -4,7 +4,7 @@ extern crate format_string_proc_macro;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
format_string_proc_macro::respan_to_invalid_format_literal!("¡");
|
format_string_proc_macro::respan_to_invalid_format_literal!("¡");
|
||||||
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
//~^ ERROR invalid format string: expected `}` but string was terminated
|
||||||
format_args!(r#concat!("¡ {"));
|
format_args!(r#concat!("¡ {"));
|
||||||
//~^ ERROR invalid format string: expected `'}'` but string was terminated
|
//~^ ERROR invalid format string: expected `}` but string was terminated
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/respanned-literal-issue-106191.rs:6:65
|
--> $DIR/respanned-literal-issue-106191.rs:6:65
|
||||||
|
|
|
|
||||||
LL | format_string_proc_macro::respan_to_invalid_format_literal!("¡");
|
LL | format_string_proc_macro::respan_to_invalid_format_literal!("¡");
|
||||||
| ^^^ expected `'}'` in format string
|
| ^^^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
|
||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/respanned-literal-issue-106191.rs:8:18
|
--> $DIR/respanned-literal-issue-106191.rs:8:18
|
||||||
|
|
|
|
||||||
LL | format_args!(r#concat!("¡ {"));
|
LL | format_args!(r#concat!("¡ {"));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `'}'` in format string
|
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `}` in format string
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
= note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error: invalid format string: expected `'}'` but string was terminated
|
error: invalid format string: expected `}` but string was terminated
|
||||||
--> $DIR/issue-51848.rs:6:20
|
--> $DIR/issue-51848.rs:6:20
|
||||||
|
|
|
|
||||||
LL | println!("{");
|
LL | println!("{");
|
||||||
| -^ expected `'}'` in format string
|
| -^ expected `}` in format string
|
||||||
| |
|
| |
|
||||||
| because of this opening brace
|
| because of this opening brace
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user