@@ -3231,18 +3231,8 @@ impl<'a> Parser<'a> {
32313231 return Err ( err)
32323232 }
32333233 let not_block = self . token != token:: OpenDelim ( token:: Brace ) ;
3234- let fat_arrow_sp = if self . token == token:: FatArrow {
3235- Some ( self . span )
3236- } else {
3237- None
3238- } ;
32393234 let thn = self . parse_block ( ) . map_err ( |mut err| {
3240- if let Some ( sp) = fat_arrow_sp {
3241- // if cond => expr
3242- err. span_suggestion ( sp,
3243- "only necessary in match arms, not before if blocks" ,
3244- "" . to_string ( ) ) ;
3245- } else if not_block {
3235+ if not_block {
32463236 err. span_label ( lo, "this `if` statement has a condition, but no block" ) ;
32473237 }
32483238 err
@@ -3444,7 +3434,7 @@ impl<'a> Parser<'a> {
34443434
34453435 let expr = self . parse_expr_res ( Restrictions :: STMT_EXPR , None )
34463436 . map_err ( |mut err| {
3447- err. span_label ( arrow_span, "while parsing the match arm starting here" ) ;
3437+ err. span_label ( arrow_span, "while parsing the ` match` arm starting here" ) ;
34483438 err
34493439 } ) ?;
34503440
@@ -3455,7 +3445,6 @@ impl<'a> Parser<'a> {
34553445 let cm = self . sess . codemap ( ) ;
34563446 self . expect_one_of ( & [ token:: Comma ] , & [ token:: CloseDelim ( token:: Brace ) ] )
34573447 . map_err ( |mut err| {
3458- err. span_label ( arrow_span, "while parsing the match arm starting here" ) ;
34593448 match ( cm. span_to_lines ( expr. span ) , cm. span_to_lines ( arm_start_span) ) {
34603449 ( Ok ( ref expr_lines) , Ok ( ref arm_start_lines) )
34613450 if arm_start_lines. lines [ 0 ] . end_col == expr_lines. lines [ 0 ] . end_col
@@ -3472,11 +3461,16 @@ impl<'a> Parser<'a> {
34723461 // | - ^^ self.span
34733462 // | |
34743463 // | parsed until here as `"y" & X`
3475- err. span_suggestion_short ( cm. next_point ( arm_start_span) ,
3476- "missing a comma here to end this match arm" ,
3477- "," . to_owned ( ) ) ;
3464+ err. span_suggestion_short (
3465+ cm. next_point ( arm_start_span) ,
3466+ "missing a comma here to end this `match` arm" ,
3467+ "," . to_owned ( )
3468+ ) ;
3469+ }
3470+ _ => {
3471+ err. span_label ( arrow_span,
3472+ "while parsing the `match` arm starting here" ) ;
34783473 }
3479- _ => { }
34803474 }
34813475 err
34823476 } ) ?;
0 commit comments