Rollup merge of #131710 - ShE3py:parse_format_apostrophes, r=compiler-errors
Remove `'apostrophes'` from `rustc_parse_format` The rest of the compiler uses \`grave accents\`, while `rustc_parse_format` uses \`'apostrophes.'\` Also makes the crate compile as a stand-alone: ``` ~/rust/compiler/rustc_parse_format $ cargo check Compiling rustc_index_macros v0.0.0 (/home/lieselotte/rust/compiler/rustc_index_macros) error[E0277]: `syn::Lit` doesn't implement `Debug` --> compiler/rustc_index_macros/src/newtype.rs:52:57 | 52 | panic!("Specified multiple max: {old:?}"); | ^^^^^^^ `syn::Lit` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `syn::Lit` = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `syn::Lit` doesn't implement `Debug` --> compiler/rustc_index_macros/src/newtype.rs:64:74 | 64 | panic!("Specified multiple debug format options: {old:?}"); | ^^^^^^^ `syn::Lit` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `syn::Lit` = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) For more information about this error, try `rustc --explain E0277`. error: could not compile `rustc_index_macros` (lib) due to 2 previous errors ``` `@rustbot` label +A-diagnostics
This commit is contained in:
commit
c99c4d4057
21 changed files with 83 additions and 83 deletions
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
syn = { version = "2.0.9", features = ["full"] }
|
||||
syn = { version = "2.0.9", features = ["full", "extra-traits"] }
|
||||
proc-macro2 = "1"
|
||||
quote = "1"
|
||||
|
||||
|
|
|
@ -473,19 +473,19 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
pos = peek_pos;
|
||||
description = format!("expected `'}}'`, found `{maybe:?}`");
|
||||
description = format!("expected `}}`, found `{}`", maybe.escape_debug());
|
||||
} else {
|
||||
description = "expected `'}'` but string was terminated".to_owned();
|
||||
description = "expected `}` but string was terminated".to_owned();
|
||||
// point at closing `"`
|
||||
pos = self.input.len() - if self.append_newline { 1 } else { 0 };
|
||||
}
|
||||
|
||||
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('}') {
|
||||
(
|
||||
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)),
|
||||
)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue