@@ -1737,16 +1737,16 @@ impl<'a> Parser<'a> {
17371737 Ok ( expr)
17381738 }
17391739
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.
17411741 pub ( super ) fn recover_unclosed_char < L > (
17421742 & self ,
1743- lifetime : Ident ,
1743+ ident : Ident ,
17441744 mk_lit_char : impl FnOnce ( Symbol , Span ) -> L ,
17451745 err : impl FnOnce ( & Self ) -> DiagnosticBuilder < ' a > ,
17461746 ) -> 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 ) {
17481748 diag. with_span_suggestion_verbose (
1749- lifetime . span . shrink_to_hi ( ) ,
1749+ ident . span . shrink_to_hi ( ) ,
17501750 "add `'` to close the char literal" ,
17511751 "'" ,
17521752 Applicability :: MaybeIncorrect ,
@@ -1755,15 +1755,15 @@ impl<'a> Parser<'a> {
17551755 } else {
17561756 err ( self )
17571757 . with_span_suggestion_verbose (
1758- lifetime . span . shrink_to_hi ( ) ,
1758+ ident . span . shrink_to_hi ( ) ,
17591759 "add `'` to close the char literal" ,
17601760 "'" ,
17611761 Applicability :: MaybeIncorrect ,
17621762 )
17631763 . emit ( ) ;
17641764 }
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 )
17671767 }
17681768
17691769 /// Recover on the syntax `do catch { ... }` suggesting `try { ... }` instead.
0 commit comments