@@ -1737,16 +1737,16 @@ impl<'a> Parser<'a> {
1737
1737
Ok ( expr)
1738
1738
}
1739
1739
1740
- /// Emit an error when a char is parsed as a lifetime because of a missing quote.
1740
+ /// Emit an error when a char is parsed as a lifetime or label because of a missing quote.
1741
1741
pub ( super ) fn recover_unclosed_char < L > (
1742
1742
& self ,
1743
- lifetime : Ident ,
1743
+ ident : Ident ,
1744
1744
mk_lit_char : impl FnOnce ( Symbol , Span ) -> L ,
1745
1745
err : impl FnOnce ( & Self ) -> DiagnosticBuilder < ' a > ,
1746
1746
) -> L {
1747
- if let Some ( diag) = self . dcx ( ) . steal_diagnostic ( lifetime . span , StashKey :: LifetimeIsChar ) {
1747
+ if let Some ( diag) = self . dcx ( ) . steal_diagnostic ( ident . span , StashKey :: LifetimeIsChar ) {
1748
1748
diag. with_span_suggestion_verbose (
1749
- lifetime . span . shrink_to_hi ( ) ,
1749
+ ident . span . shrink_to_hi ( ) ,
1750
1750
"add `'` to close the char literal" ,
1751
1751
"'" ,
1752
1752
Applicability :: MaybeIncorrect ,
@@ -1755,15 +1755,15 @@ impl<'a> Parser<'a> {
1755
1755
} else {
1756
1756
err ( self )
1757
1757
. with_span_suggestion_verbose (
1758
- lifetime . span . shrink_to_hi ( ) ,
1758
+ ident . span . shrink_to_hi ( ) ,
1759
1759
"add `'` to close the char literal" ,
1760
1760
"'" ,
1761
1761
Applicability :: MaybeIncorrect ,
1762
1762
)
1763
1763
. emit ( ) ;
1764
1764
}
1765
- let name = lifetime . without_first_quote ( ) . name ;
1766
- mk_lit_char ( name, lifetime . span )
1765
+ let name = ident . without_first_quote ( ) . name ;
1766
+ mk_lit_char ( name, ident . span )
1767
1767
}
1768
1768
1769
1769
/// Recover on the syntax `do catch { ... }` suggesting `try { ... }` instead.
0 commit comments