@@ -724,7 +724,7 @@ impl<'a> Parser<'a> {
724724 if let Some ( sp) = unmatched. unclosed_span {
725725 err. span_label ( sp, "in order to close this..." ) ;
726726 }
727- err. span_suggestion_short_with_applicability (
727+ err. span_suggestion_short (
728728 self . sess . source_map ( ) . next_point ( self . prev_span ) ,
729729 & format ! ( "{} may belong here" , delim. to_string( ) ) ,
730730 delim. to_string ( ) ,
@@ -1180,7 +1180,7 @@ impl<'a> Parser<'a> {
11801180 // self.struct_span_err(
11811181 // self.span,
11821182 // &format!("expected `>`, found `{}`", self.this_token_to_string()),
1183- // // ).span_suggestion_short_with_applicability (
1183+ // // ).span_suggestion_short (
11841184 // ).emit();
11851185 // Ok(())
11861186 // }
@@ -8503,20 +8503,7 @@ impl<'a> Parser<'a> {
85038503 module : self . parse_mod_items ( & token:: Eof , lo) ?,
85048504 span : lo. to ( self . span ) ,
85058505 } ) ;
8506- for unmatched in & self . unclosed_delims {
8507- let mut err = self . struct_span_err ( unmatched. found_span , & format ! (
8508- "incorrect close delimiter: `{}`" ,
8509- pprust:: token_to_string( & token:: Token :: CloseDelim ( unmatched. found_delim) ) ,
8510- ) ) ;
8511- err. span_label ( unmatched. found_span , "incorrect close delimiter" ) ;
8512- if let Some ( sp) = unmatched. candidate_span {
8513- err. span_label ( sp, "close delimiter possibly meant for this" ) ;
8514- }
8515- if let Some ( sp) = unmatched. unclosed_span {
8516- err. span_label ( sp, "un-closed delimiter" ) ;
8517- }
8518- err. emit ( ) ;
8519- }
8506+ emit_unclosed_delims ( & self . unclosed_delims , self . diagnostic ( ) ) ;
85208507 self . unclosed_delims . clear ( ) ;
85218508 krate
85228509 }
@@ -8547,3 +8534,20 @@ impl<'a> Parser<'a> {
85478534 }
85488535 }
85498536}
8537+
8538+ pub fn emit_unclosed_delims ( unclosed_delims : & [ UnmatchedBrace ] , handler : & errors:: Handler ) {
8539+ for unmatched in unclosed_delims {
8540+ let mut err = handler. struct_span_err ( unmatched. found_span , & format ! (
8541+ "incorrect close delimiter: `{}`" ,
8542+ pprust:: token_to_string( & token:: Token :: CloseDelim ( unmatched. found_delim) ) ,
8543+ ) ) ;
8544+ err. span_label ( unmatched. found_span , "incorrect close delimiter" ) ;
8545+ if let Some ( sp) = unmatched. candidate_span {
8546+ err. span_label ( sp, "close delimiter possibly meant for this" ) ;
8547+ }
8548+ if let Some ( sp) = unmatched. unclosed_span {
8549+ err. span_label ( sp, "un-closed delimiter" ) ;
8550+ }
8551+ err. emit ( ) ;
8552+ }
8553+ }
0 commit comments