@@ -308,10 +308,7 @@ fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -
308
308
309
309
match self_ty. kind ( ) {
310
310
_ if is_copy => builder. copy_shim ( ) ,
311
- ty:: Array ( ty, len) => {
312
- let len = len. eval_usize ( tcx, param_env) ;
313
- builder. array_shim ( dest, src, ty, len)
314
- }
311
+ ty:: Array ( ty, len) => builder. array_shim ( dest, src, ty, len) ,
315
312
ty:: Closure ( _, substs) => {
316
313
builder. tuple_like_shim ( dest, src, substs. as_closure ( ) . upvar_tys ( ) )
317
314
}
@@ -485,7 +482,13 @@ impl CloneShimBuilder<'tcx> {
485
482
}
486
483
}
487
484
488
- fn array_shim ( & mut self , dest : Place < ' tcx > , src : Place < ' tcx > , ty : Ty < ' tcx > , len : u64 ) {
485
+ fn array_shim (
486
+ & mut self ,
487
+ dest : Place < ' tcx > ,
488
+ src : Place < ' tcx > ,
489
+ ty : Ty < ' tcx > ,
490
+ len : & ' tcx ty:: Const < ' tcx > ,
491
+ ) {
489
492
let tcx = self . tcx ;
490
493
let span = self . span ;
491
494
@@ -503,7 +506,11 @@ impl CloneShimBuilder<'tcx> {
503
506
) ) ) ,
504
507
self . make_statement( StatementKind :: Assign ( box (
505
508
end,
506
- Rvalue :: Use ( Operand :: Constant ( self . make_usize( len) ) ) ,
509
+ Rvalue :: Use ( Operand :: Constant ( box Constant {
510
+ span: self . span,
511
+ user_ty: None ,
512
+ literal: len,
513
+ } ) ) ,
507
514
) ) ) ,
508
515
] ;
509
516
self . block ( inits, TerminatorKind :: Goto { target : BasicBlock :: new ( 1 ) } , false ) ;
0 commit comments