@@ -674,6 +674,14 @@ pub enum ProjectionElem<'tcx, V> {
674
674
from_end : bool ,
675
675
} ,
676
676
677
+ /// These indices are generated by slice patterns.
678
+ ///
679
+ /// slice[from:-to] in Python terms.
680
+ Subslice {
681
+ from : u32 ,
682
+ to : u32 ,
683
+ } ,
684
+
677
685
/// "Downcast" to a variant of an ADT. Currently, we only introduce
678
686
/// this for ADTs with more than one variant. It may be better to
679
687
/// just introduce it always, or always for enums.
@@ -753,6 +761,14 @@ impl<'tcx> Debug for Lvalue<'tcx> {
753
761
write ! ( fmt, "{:?}[{:?} of {:?}]" , data. base, offset, min_length) ,
754
762
ProjectionElem :: ConstantIndex { offset, min_length, from_end : true } =>
755
763
write ! ( fmt, "{:?}[-{:?} of {:?}]" , data. base, offset, min_length) ,
764
+ ProjectionElem :: Subslice { from, to } if to == 0 =>
765
+ write ! ( fmt, "{:?}[{:?}:" , data. base, from) ,
766
+ ProjectionElem :: Subslice { from, to } if from == 0 =>
767
+ write ! ( fmt, "{:?}[:-{:?}]" , data. base, to) ,
768
+ ProjectionElem :: Subslice { from, to } =>
769
+ write ! ( fmt, "{:?}[{:?}:-{:?}]" , data. base,
770
+ from, to) ,
771
+
756
772
} ,
757
773
}
758
774
}
@@ -856,17 +872,6 @@ pub enum Rvalue<'tcx> {
856
872
/// away after type-checking and before lowering.
857
873
Aggregate ( AggregateKind < ' tcx > , Vec < Operand < ' tcx > > ) ,
858
874
859
- /// Generates a slice of the form `&input[from_start..L-from_end]`
860
- /// where `L` is the length of the slice. This is only created by
861
- /// slice pattern matching, so e.g. a pattern of the form `[x, y,
862
- /// .., z]` might create a slice with `from_start=2` and
863
- /// `from_end=1`.
864
- Slice {
865
- input : Lvalue < ' tcx > ,
866
- from_start : usize ,
867
- from_end : usize ,
868
- } ,
869
-
870
875
InlineAsm {
871
876
asm : InlineAsm ,
872
877
outputs : Vec < Lvalue < ' tcx > > ,
@@ -972,8 +977,6 @@ impl<'tcx> Debug for Rvalue<'tcx> {
972
977
InlineAsm { ref asm, ref outputs, ref inputs } => {
973
978
write ! ( fmt, "asm!({:?} : {:?} : {:?})" , asm, outputs, inputs)
974
979
}
975
- Slice { ref input, from_start, from_end } =>
976
- write ! ( fmt, "{:?}[{:?}..-{:?}]" , input, from_start, from_end) ,
977
980
978
981
Ref ( _, borrow_kind, ref lv) => {
979
982
let kind_str = match borrow_kind {
0 commit comments