diff options
| author | bors <bors@rust-lang.org> | 2023-04-16 00:07:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-16 00:07:06 +0000 |
| commit | c6fb7b9815aea87fb5ced1c683212871699c907c (patch) | |
| tree | 524293a9a11da3bee727d8b5407827b2108d1a19 /compiler/rustc_parse/src/parser/diagnostics.rs | |
| parent | 50b816f71f9055d6f162bec69c30b7574bb8e91a (diff) | |
| parent | a8983749bd1b92359ca6d82f52bf026b0f9b8d71 (diff) | |
| download | rust-c6fb7b9815aea87fb5ced1c683212871699c907c.tar.gz rust-c6fb7b9815aea87fb5ced1c683212871699c907c.zip | |
Auto merge of #110375 - JohnTitor:rollup-ghvdaxm, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #110033 (Add 1.69.0 release notes) - #110272 (fix: skip implied bounds if unconstrained lifetime exists) - #110307 (Allow everyone to set the beta-nominated label) - #110347 (Add intra-doc links to size_of_* functions) - #110350 (Add a UI test for #79605) - #110356 (Fix `x test rust-installer` when `cargo` is set to a relative path) - #110364 (remove redundant clones) - #110366 (fix some clippy::complexity) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser/diagnostics.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index e03ce5d7120..c14c7f2fa0d 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -570,15 +570,13 @@ impl<'a> Parser<'a> { let expect = tokens_to_string(&expected); let actual = super::token_descr(&self.token); let (msg_exp, (label_sp, label_exp)) = if expected.len() > 1 { + let fmt = format!("expected one of {expect}, found {actual}"); let short_expect = if expected.len() > 6 { format!("{} possible tokens", expected.len()) } else { - expect.clone() + expect }; - ( - format!("expected one of {expect}, found {actual}"), - (self.prev_token.span.shrink_to_hi(), format!("expected one of {short_expect}")), - ) + (fmt, (self.prev_token.span.shrink_to_hi(), format!("expected one of {short_expect}"))) } else if expected.is_empty() { ( format!("unexpected token: {actual}"), |
