@@ -1988,7 +1988,7 @@ impl<'tcx> Operand<'tcx> {
19881988 pub fn to_copy ( & self ) -> Self {
19891989 match * self {
19901990 Operand :: Copy ( _) | Operand :: Constant ( _) => self . clone ( ) ,
1991- Operand :: Move ( ref place) => Operand :: Copy ( place. clone ( ) ) ,
1991+ Operand :: Move ( place) => Operand :: Copy ( place) ,
19921992 }
19931993 }
19941994}
@@ -2462,11 +2462,15 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
24622462 let projs: Vec < _ > = self
24632463 . projs
24642464 . iter ( )
2465- . map ( |elem| match elem {
2465+ . map ( |& elem| match elem {
24662466 Deref => Deref ,
2467- Field ( f, ( ) ) => Field ( f. clone ( ) , ( ) ) ,
2467+ Field ( f, ( ) ) => Field ( f, ( ) ) ,
24682468 Index ( ( ) ) => Index ( ( ) ) ,
2469- elem => elem. clone ( ) ,
2469+ Downcast ( symbol, variantidx) => Downcast ( symbol, variantidx) ,
2470+ ConstantIndex { offset, min_length, from_end } => {
2471+ ConstantIndex { offset, min_length, from_end }
2472+ }
2473+ Subslice { from, to, from_end } => Subslice { from, to, from_end } ,
24702474 } )
24712475 . collect ( ) ;
24722476
@@ -2862,11 +2866,15 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
28622866 fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
28632867 use crate :: mir:: ProjectionElem :: * ;
28642868
2865- match self {
2869+ match * self {
28662870 Deref => Deref ,
2867- Field ( f, ty) => Field ( * f, ty. fold_with ( folder) ) ,
2871+ Field ( f, ty) => Field ( f, ty. fold_with ( folder) ) ,
28682872 Index ( v) => Index ( v. fold_with ( folder) ) ,
2869- elem => elem. clone ( ) ,
2873+ Downcast ( symbol, variantidx) => Downcast ( symbol, variantidx) ,
2874+ ConstantIndex { offset, min_length, from_end } => {
2875+ ConstantIndex { offset, min_length, from_end }
2876+ }
2877+ Subslice { from, to, from_end } => Subslice { from, to, from_end } ,
28702878 }
28712879 }
28722880
@@ -2911,7 +2919,7 @@ impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
29112919impl < ' tcx > TypeFoldable < ' tcx > for Constant < ' tcx > {
29122920 fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
29132921 Constant {
2914- span : self . span . clone ( ) ,
2922+ span : self . span ,
29152923 user_ty : self . user_ty . fold_with ( folder) ,
29162924 literal : self . literal . fold_with ( folder) ,
29172925 }
0 commit comments