@@ -25,10 +25,10 @@ use crate::errors::{
2525    GenericArgsInPatRequireTurbofishSyntax ,  InclusiveRangeExtraEquals ,  InclusiveRangeMatchArrow , 
2626    InclusiveRangeNoEnd ,  InvalidMutInPattern ,  ParenRangeSuggestion ,  PatternOnWrongSideOfAt , 
2727    RemoveLet ,  RepeatedMutInPattern ,  SwitchRefBoxOrder ,  TopLevelOrPatternNotAllowed , 
28-     TopLevelOrPatternNotAllowedSugg ,  TrailingVertNotAllowed ,  UnexpectedExpressionInPattern , 
29-     UnexpectedExpressionInPatternSugg ,   UnexpectedLifetimeInPattern ,   UnexpectedParenInRangePat , 
30-     UnexpectedParenInRangePatSugg ,   UnexpectedVertVertBeforeFunctionParam , 
31-     UnexpectedVertVertInPattern ,  WrapInParens , 
28+     TopLevelOrPatternNotAllowedSugg ,  TrailingVertNotAllowed ,  TrailingVertSuggestion , 
29+     UnexpectedExpressionInPattern ,   UnexpectedExpressionInPatternSugg ,   UnexpectedLifetimeInPattern , 
30+     UnexpectedParenInRangePat ,   UnexpectedParenInRangePatSugg , 
31+     UnexpectedVertVertBeforeFunctionParam ,   UnexpectedVertVertInPattern ,  WrapInParens , 
3232} ; 
3333use  crate :: parser:: expr:: { DestructuredFloat ,  could_be_unclosed_char_literal} ; 
3434use  crate :: { exp,  maybe_recover_from_interpolated_ty_qpath} ; 
@@ -268,10 +268,9 @@ impl<'a> Parser<'a> {
268268
269269        if  let  PatKind :: Or ( pats)  = & pat. kind  { 
270270            let  span = pat. span ; 
271-             let  sub = if  pats. len ( )  == 1  { 
272-                 Some ( TopLevelOrPatternNotAllowedSugg :: RemoveLeadingVert  { 
273-                     span :  span. with_hi ( span. lo ( )  + BytePos ( 1 ) ) , 
274-                 } ) 
271+             let  sub = if  let  [ _]  = & pats[ ..]  { 
272+                 let  span = span. with_hi ( span. lo ( )  + BytePos ( 1 ) ) ; 
273+                 Some ( TopLevelOrPatternNotAllowedSugg :: RemoveLeadingVert  {  span } ) 
275274            }  else  { 
276275                Some ( TopLevelOrPatternNotAllowedSugg :: WrapInParens  { 
277276                    span, 
@@ -363,6 +362,9 @@ impl<'a> Parser<'a> {
363362                self . dcx ( ) . emit_err ( TrailingVertNotAllowed  { 
364363                    span :  self . token . span , 
365364                    start :  lo, 
365+                     suggestion :  TrailingVertSuggestion  { 
366+                         span :  self . prev_token . span . shrink_to_hi ( ) . with_hi ( self . token . span . hi ( ) ) , 
367+                     } , 
366368                    token :  self . token . clone ( ) , 
367369                    note_double_vert :  matches ! ( self . token. kind,  token:: OrOr ) , 
368370                } ) ; 
0 commit comments