@@ -587,7 +587,7 @@ enum Constructor<'tcx> {
587587 /// Ranges of literal values (`2..=5` and `2..5`).
588588 ConstantRange ( u128 , u128 , Ty < ' tcx > , RangeEnd , Span ) ,
589589 /// Array patterns of length n.
590- Slice ( u64 ) ,
590+ FixedLenSlice ( u64 ) ,
591591}
592592
593593// Ignore spans when comparing, they don't carry semantic information as they are only for lints.
@@ -601,7 +601,7 @@ impl<'tcx> std::cmp::PartialEq for Constructor<'tcx> {
601601 Constructor :: ConstantRange ( a_start, a_end, a_ty, a_range_end, _) ,
602602 Constructor :: ConstantRange ( b_start, b_end, b_ty, b_range_end, _) ,
603603 ) => a_start == b_start && a_end == b_end && a_ty == b_ty && a_range_end == b_range_end,
604- ( Constructor :: Slice ( a) , Constructor :: Slice ( b) ) => a == b,
604+ ( Constructor :: FixedLenSlice ( a) , Constructor :: FixedLenSlice ( b) ) => a == b,
605605 _ => false ,
606606 }
607607 }
@@ -610,7 +610,7 @@ impl<'tcx> std::cmp::PartialEq for Constructor<'tcx> {
610610impl < ' tcx > Constructor < ' tcx > {
611611 fn is_slice ( & self ) -> bool {
612612 match self {
613- Slice { .. } => true ,
613+ FixedLenSlice { .. } => true ,
614614 _ => false ,
615615 }
616616 }
@@ -644,7 +644,7 @@ impl<'tcx> Constructor<'tcx> {
644644 ty:: Const :: from_bits( tcx, * hi, ty) ,
645645 )
646646 }
647- Constructor :: Slice ( val) => format ! ( "[{}]" , val) ,
647+ Constructor :: FixedLenSlice ( val) => format ! ( "[{}]" , val) ,
648648 _ => bug ! ( "bad constructor being displayed: `{:?}" , self ) ,
649649 }
650650 }
@@ -707,7 +707,7 @@ impl<'tcx> Constructor<'tcx> {
707707 match ty. kind {
708708 ty:: Tuple ( ref fs) => fs. len ( ) as u64 ,
709709 ty:: Slice ( ..) | ty:: Array ( ..) => match * self {
710- Slice ( length) => length,
710+ FixedLenSlice ( length) => length,
711711 ConstantValue ( ..) => 0 ,
712712 _ => bug ! ( "bad slice pattern {:?} {:?}" , self , ty) ,
713713 } ,
@@ -980,14 +980,14 @@ fn all_constructors<'a, 'tcx>(
980980 . collect ( ) ,
981981 ty:: Array ( ref sub_ty, len) if len. try_eval_usize ( cx. tcx , cx. param_env ) . is_some ( ) => {
982982 let len = len. eval_usize ( cx. tcx , cx. param_env ) ;
983- if len != 0 && cx. is_uninhabited ( sub_ty) { vec ! [ ] } else { vec ! [ Slice ( len) ] }
983+ if len != 0 && cx. is_uninhabited ( sub_ty) { vec ! [ ] } else { vec ! [ FixedLenSlice ( len) ] }
984984 }
985985 // Treat arrays of a constant but unknown length like slices.
986986 ty:: Array ( ref sub_ty, _) | ty:: Slice ( ref sub_ty) => {
987987 if cx. is_uninhabited ( sub_ty) {
988- vec ! [ Slice ( 0 ) ]
988+ vec ! [ FixedLenSlice ( 0 ) ]
989989 } else {
990- ( 0 ..pcx. max_slice_length + 1 ) . map ( |length| Slice ( length) ) . collect ( )
990+ ( 0 ..pcx. max_slice_length + 1 ) . map ( |length| FixedLenSlice ( length) ) . collect ( )
991991 }
992992 }
993993 ty:: Adt ( def, substs) if def. is_enum ( ) => def
@@ -1711,15 +1711,17 @@ fn pat_constructors<'tcx>(
17111711 pat. span,
17121712 ) ] ) ,
17131713 PatKind :: Array { .. } => match pcx. ty . kind {
1714- ty:: Array ( _, length) => Some ( vec ! [ Slice ( length. eval_usize( cx. tcx, cx. param_env) ) ] ) ,
1714+ ty:: Array ( _, length) => {
1715+ Some ( vec ! [ FixedLenSlice ( length. eval_usize( cx. tcx, cx. param_env) ) ] )
1716+ }
17151717 _ => span_bug ! ( pat. span, "bad ty {:?} for array pattern" , pcx. ty) ,
17161718 } ,
17171719 PatKind :: Slice { ref prefix, ref slice, ref suffix } => {
17181720 let pat_len = prefix. len ( ) as u64 + suffix. len ( ) as u64 ;
17191721 if slice. is_some ( ) {
1720- Some ( ( pat_len..pcx. max_slice_length + 1 ) . map ( Slice ) . collect ( ) )
1722+ Some ( ( pat_len..pcx. max_slice_length + 1 ) . map ( FixedLenSlice ) . collect ( ) )
17211723 } else {
1722- Some ( vec ! [ Slice ( pat_len) ] )
1724+ Some ( vec ! [ FixedLenSlice ( pat_len) ] )
17231725 }
17241726 }
17251727 PatKind :: Or { .. } => {
@@ -1741,7 +1743,7 @@ fn constructor_sub_pattern_tys<'a, 'tcx>(
17411743 match ty. kind {
17421744 ty:: Tuple ( ref fs) => fs. into_iter ( ) . map ( |t| t. expect_ty ( ) ) . collect ( ) ,
17431745 ty:: Slice ( ty) | ty:: Array ( ty, _) => match * ctor {
1744- Slice ( length) => ( 0 ..length) . map ( |_| ty) . collect ( ) ,
1746+ FixedLenSlice ( length) => ( 0 ..length) . map ( |_| ty) . collect ( ) ,
17451747 ConstantValue ( ..) => vec ! [ ] ,
17461748 _ => bug ! ( "bad slice pattern {:?} {:?}" , ctor, ty) ,
17471749 } ,
@@ -2238,7 +2240,7 @@ fn specialize_one_pattern<'p, 'a: 'p, 'q: 'p, 'tcx>(
22382240
22392241 PatKind :: Array { ref prefix, ref slice, ref suffix }
22402242 | PatKind :: Slice { ref prefix, ref slice, ref suffix } => match * constructor {
2241- Slice ( ..) => {
2243+ FixedLenSlice ( ..) => {
22422244 let pat_len = prefix. len ( ) + suffix. len ( ) ;
22432245 if let Some ( slice_count) = ctor_wild_subpatterns. len ( ) . checked_sub ( pat_len) {
22442246 if slice_count == 0 || slice. is_some ( ) {
0 commit comments