diff options
| author | Ralf Jung <post@ralfj.de> | 2024-09-10 09:58:14 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-09-10 09:58:14 +0200 |
| commit | c78cd659887686d133055c4310a1e269716e0238 (patch) | |
| tree | 7dafcef96ecbcbf6c6b2873294c44714912e43b4 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 0d12c5809f10fa6dea73af038677949a9b0286b1 (diff) | |
| parent | 123757ae07c05d8adafbe00d10b7119608ee13d9 (diff) | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 84684e808d9..ecc4cd96faf 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2050,7 +2050,7 @@ impl<'a> Parser<'a> { }; // On an error path, eagerly consider a lifetime to be an unclosed character lit, if that // makes sense. - if let Some(ident) = self.token.lifetime() + if let Some((ident, IdentIsRaw::No)) = self.token.lifetime() && could_be_unclosed_char_literal(ident) { let lt = self.expect_lifetime(); @@ -2925,9 +2925,9 @@ impl<'a> Parser<'a> { } pub(crate) fn eat_label(&mut self) -> Option<Label> { - if let Some(ident) = self.token.lifetime() { + if let Some((ident, is_raw)) = self.token.lifetime() { // Disallow `'fn`, but with a better error message than `expect_lifetime`. - if ident.without_first_quote().is_reserved() { + if matches!(is_raw, IdentIsRaw::No) && ident.without_first_quote().is_reserved() { self.dcx().emit_err(errors::InvalidLabel { span: ident.span, name: ident.name }); } |
