File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,13 @@ impl<'a> Parser<'a> {
179179 & self . sess . span_diagnostic
180180 }
181181
182+ pub ( super ) fn diagnostic_snapshot ( & self ) -> Self {
183+ let mut snapshot = self . clone ( ) ;
184+ // initialize unclosed_delims to avoid duplicate errors.
185+ snapshot. unclosed_delims = vec ! [ ] ;
186+ snapshot
187+ }
188+
182189 pub ( super ) fn span_to_snippet ( & self , span : Span ) -> Result < String , SpanSnippetError > {
183190 self . sess . source_map ( ) . span_to_snippet ( span)
184191 }
Original file line number Diff line number Diff line change @@ -625,8 +625,7 @@ impl<'a> Parser<'a> {
625625 } else if self . check_type ( ) {
626626 // Parse type argument.
627627 let is_const_fn = self . look_ahead ( 1 , |t| t. kind == token:: OpenDelim ( token:: Paren ) ) ;
628- let mut snapshot = self . clone ( ) ;
629- snapshot. unclosed_delims = vec ! [ ] ;
628+ let mut snapshot = self . diagnostic_snapshot ( ) ;
630629 match self . parse_ty ( ) {
631630 Ok ( ty) => GenericArg :: Type ( ty) ,
632631 Err ( err) => {
You can’t perform that action at this time.
0 commit comments