@@ -373,13 +373,17 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
373373 PatternKind :: Constant { value : hi } ) => {
374374 use std:: cmp:: Ordering ;
375375 match ( end, compare_const_vals ( & lo. val , & hi. val , ty) . unwrap ( ) ) {
376- ( RangeEnd :: Excluded , Ordering :: Less ) => { } ,
377- ( RangeEnd :: Excluded , _) => span_err ! (
378- self . tcx. sess,
379- lo_expr. span,
380- E0579 ,
381- "lower range bound must be less than upper" ,
382- ) ,
376+ ( RangeEnd :: Excluded , Ordering :: Less ) =>
377+ PatternKind :: Range { lo, hi, end } ,
378+ ( RangeEnd :: Excluded , _) => {
379+ span_err ! (
380+ self . tcx. sess,
381+ lo_expr. span,
382+ E0579 ,
383+ "lower range bound must be less than upper" ,
384+ ) ;
385+ PatternKind :: Wild
386+ } ,
383387 ( RangeEnd :: Included , Ordering :: Greater ) => {
384388 let mut err = struct_span_err ! (
385389 self . tcx. sess,
@@ -399,10 +403,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
399403 to be less than or equal to the end of the range.") ;
400404 }
401405 err. emit ( ) ;
406+ PatternKind :: Wild
402407 } ,
403- ( RangeEnd :: Included , _) => { }
408+ ( RangeEnd :: Included , _) => PatternKind :: Range { lo , hi , end } ,
404409 }
405- PatternKind :: Range { lo, hi, end }
406410 }
407411 _ => PatternKind :: Wild
408412 }
0 commit comments