@@ -56,13 +56,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
5656 ( ( prefix. len ( ) + suffix. len ( ) ) . try_into ( ) . unwrap ( ) , false )
5757 } ;
5858
59- if self . subslice_work_optimizing ( prefix) {
59+ if self . subslice_work_optimizing ( prefix) && opt_slice . is_none ( ) && suffix . is_empty ( ) {
6060 let elem_ty = prefix[ 0 ] . ty ;
6161 let prefix_valtree = self . simplify_const_pattern_slice_into_valtree ( prefix) ;
6262
6363 let project = PlaceElem :: Subslice {
6464 from : 0 as u64 ,
65- to : prefix. len ( ) as u64 ,
65+ to : prefix. len ( ) as u64 , // TODO: look at this
6666 from_end : !exact_size,
6767 } ;
6868
@@ -81,7 +81,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
8181 let elem = ProjectionElem :: ConstantIndex {
8282 offset : idx as u64 ,
8383 min_length,
84- from_end : !exact_size ,
84+ from_end : false ,
8585 } ;
8686 MatchPairTree :: for_pattern ( place. clone_project ( elem) , subpattern, self )
8787 } ) ) ;
@@ -91,7 +91,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
9191 let suffix_len = suffix. len ( ) as u64 ;
9292 let subslice = place. clone_project ( PlaceElem :: Subslice {
9393 from : prefix. len ( ) as u64 ,
94- to : if exact_size { min_length - suffix_len } else { suffix_len } ,
94+ to : if exact_size { min_length - suffix_len } else { suffix_len } , // TODO: look at this
9595 from_end : !exact_size,
9696 } ) ;
9797 match_pairs. push ( MatchPairTree :: for_pattern ( subslice, subslice_pat, self ) ) ;
0 commit comments