diff options
| author | Michael Goulet <michael@errs.io> | 2024-09-05 05:43:55 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-09-06 10:32:48 -0400 |
| commit | 97910580aadab067ef13b5d0094a57e124c743ea (patch) | |
| tree | 8fd86ff49b72fb83a0a446c860b543ef9cbf6606 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 3b3e43a386a9b89609fe529921bdd49ba3511fb8 (diff) | |
| download | rust-97910580aadab067ef13b5d0094a57e124c743ea.tar.gz rust-97910580aadab067ef13b5d0094a57e124c743ea.zip | |
Add initial support for raw lifetimes
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 }); } |
