@@ -445,43 +445,43 @@ fn codegen_stmt<'tcx>(
445445 StatementKind :: Assign ( to_place_and_rval) => {
446446 let lval = codegen_place ( fx, to_place_and_rval. 0 ) ;
447447 let dest_layout = lval. layout ( ) ;
448- match & to_place_and_rval. 1 {
449- Rvalue :: Use ( operand) => {
448+ match to_place_and_rval. 1 {
449+ Rvalue :: Use ( ref operand) => {
450450 let val = codegen_operand ( fx, operand) ;
451451 lval. write_cvalue ( fx, val) ;
452452 }
453453 Rvalue :: Ref ( _, _, place) | Rvalue :: AddressOf ( _, place) => {
454- let place = codegen_place ( fx, * place) ;
454+ let place = codegen_place ( fx, place) ;
455455 let ref_ = place. place_ref ( fx, lval. layout ( ) ) ;
456456 lval. write_cvalue ( fx, ref_) ;
457457 }
458458 Rvalue :: ThreadLocalRef ( def_id) => {
459- let val = crate :: constant:: codegen_tls_ref ( fx, * def_id, lval. layout ( ) ) ;
459+ let val = crate :: constant:: codegen_tls_ref ( fx, def_id, lval. layout ( ) ) ;
460460 lval. write_cvalue ( fx, val) ;
461461 }
462- Rvalue :: BinaryOp ( bin_op, lhs, rhs) => {
462+ Rvalue :: BinaryOp ( bin_op, ref lhs, ref rhs) => {
463463 let lhs = codegen_operand ( fx, lhs) ;
464464 let rhs = codegen_operand ( fx, rhs) ;
465465
466- let res = crate :: num:: codegen_binop ( fx, * bin_op, lhs, rhs) ;
466+ let res = crate :: num:: codegen_binop ( fx, bin_op, lhs, rhs) ;
467467 lval. write_cvalue ( fx, res) ;
468468 }
469- Rvalue :: CheckedBinaryOp ( bin_op, lhs, rhs) => {
469+ Rvalue :: CheckedBinaryOp ( bin_op, ref lhs, ref rhs) => {
470470 let lhs = codegen_operand ( fx, lhs) ;
471471 let rhs = codegen_operand ( fx, rhs) ;
472472
473473 let res = if !fx. tcx . sess . overflow_checks ( ) {
474474 let val =
475- crate :: num:: codegen_int_binop ( fx, * bin_op, lhs, rhs) . load_scalar ( fx) ;
475+ crate :: num:: codegen_int_binop ( fx, bin_op, lhs, rhs) . load_scalar ( fx) ;
476476 let is_overflow = fx. bcx . ins ( ) . iconst ( types:: I8 , 0 ) ;
477477 CValue :: by_val_pair ( val, is_overflow, lval. layout ( ) )
478478 } else {
479- crate :: num:: codegen_checked_int_binop ( fx, * bin_op, lhs, rhs)
479+ crate :: num:: codegen_checked_int_binop ( fx, bin_op, lhs, rhs)
480480 } ;
481481
482482 lval. write_cvalue ( fx, res) ;
483483 }
484- Rvalue :: UnaryOp ( un_op, operand) => {
484+ Rvalue :: UnaryOp ( un_op, ref operand) => {
485485 let operand = codegen_operand ( fx, operand) ;
486486 let layout = operand. layout ( ) ;
487487 let val = operand. load_scalar ( fx) ;
@@ -509,8 +509,8 @@ fn codegen_stmt<'tcx>(
509509 } ;
510510 lval. write_cvalue ( fx, res) ;
511511 }
512- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ReifyFnPointer ) , operand, to_ty) => {
513- let from_ty = fx. monomorphize ( & operand. ty ( & fx. mir . local_decls , fx. tcx ) ) ;
512+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ReifyFnPointer ) , ref operand, to_ty) => {
513+ let from_ty = fx. monomorphize ( operand. ty ( & fx. mir . local_decls , fx. tcx ) ) ;
514514 let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
515515 match * from_ty. kind ( ) {
516516 ty:: FnDef ( def_id, substs) => {
@@ -530,14 +530,14 @@ fn codegen_stmt<'tcx>(
530530 _ => bug ! ( "Trying to ReifyFnPointer on non FnDef {:?}" , from_ty) ,
531531 }
532532 }
533- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: UnsafeFnPointer ) , operand, to_ty)
534- | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: MutToConstPointer ) , operand, to_ty)
535- | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ArrayToPointer ) , operand, to_ty) => {
533+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: UnsafeFnPointer ) , ref operand, to_ty)
534+ | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: MutToConstPointer ) , ref operand, to_ty)
535+ | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ArrayToPointer ) , ref operand, to_ty) => {
536536 let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
537537 let operand = codegen_operand ( fx, operand) ;
538538 lval. write_cvalue ( fx, operand. cast_pointer_to ( to_layout) ) ;
539539 }
540- Rvalue :: Cast ( CastKind :: Misc , operand, to_ty) => {
540+ Rvalue :: Cast ( CastKind :: Misc , ref operand, to_ty) => {
541541 let operand = codegen_operand ( fx, operand) ;
542542 let from_ty = operand. layout ( ) . ty ;
543543 let to_ty = fx. monomorphize ( to_ty) ;
@@ -577,12 +577,12 @@ fn codegen_stmt<'tcx>(
577577
578578 use rustc_target:: abi:: { Int , TagEncoding , Variants } ;
579579
580- match & operand. layout ( ) . variants {
580+ match operand. layout ( ) . variants {
581581 Variants :: Single { index } => {
582582 let discr = operand
583583 . layout ( )
584584 . ty
585- . discriminant_for_variant ( fx. tcx , * index)
585+ . discriminant_for_variant ( fx. tcx , index)
586586 . unwrap ( ) ;
587587 let discr = if discr. ty . is_signed ( ) {
588588 fx. layout_of ( discr. ty ) . size . sign_extend ( discr. val )
@@ -595,7 +595,7 @@ fn codegen_stmt<'tcx>(
595595 lval. write_cvalue ( fx, discr) ;
596596 }
597597 Variants :: Multiple {
598- tag,
598+ ref tag,
599599 tag_field,
600600 tag_encoding : TagEncoding :: Direct ,
601601 variants : _,
@@ -604,7 +604,7 @@ fn codegen_stmt<'tcx>(
604604
605605 // Read the tag/niche-encoded discriminant from memory.
606606 let encoded_discr =
607- operand. value_field ( fx, mir:: Field :: new ( * tag_field) ) ;
607+ operand. value_field ( fx, mir:: Field :: new ( tag_field) ) ;
608608 let encoded_discr = encoded_discr. load_scalar ( fx) ;
609609
610610 // Decode the discriminant (specifically if it's niche-encoded).
@@ -634,7 +634,7 @@ fn codegen_stmt<'tcx>(
634634 }
635635 Rvalue :: Cast (
636636 CastKind :: Pointer ( PointerCast :: ClosureFnPointer ( _) ) ,
637- operand,
637+ ref operand,
638638 _to_ty,
639639 ) => {
640640 let operand = codegen_operand ( fx, operand) ;
@@ -654,18 +654,18 @@ fn codegen_stmt<'tcx>(
654654 _ => bug ! ( "{} cannot be cast to a fn ptr" , operand. layout( ) . ty) ,
655655 }
656656 }
657- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , operand, _to_ty) => {
657+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , ref operand, _to_ty) => {
658658 let operand = codegen_operand ( fx, operand) ;
659659 operand. unsize_value ( fx, lval) ;
660660 }
661661 Rvalue :: Discriminant ( place) => {
662- let place = codegen_place ( fx, * place) ;
662+ let place = codegen_place ( fx, place) ;
663663 let value = place. to_cvalue ( fx) ;
664664 let discr =
665665 crate :: discriminant:: codegen_get_discriminant ( fx, value, dest_layout) ;
666666 lval. write_cvalue ( fx, discr) ;
667667 }
668- Rvalue :: Repeat ( operand, times) => {
668+ Rvalue :: Repeat ( ref operand, times) => {
669669 let operand = codegen_operand ( fx, operand) ;
670670 let times = fx
671671 . monomorphize ( times)
@@ -704,7 +704,7 @@ fn codegen_stmt<'tcx>(
704704 }
705705 }
706706 Rvalue :: Len ( place) => {
707- let place = codegen_place ( fx, * place) ;
707+ let place = codegen_place ( fx, place) ;
708708 let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
709709 let len = codegen_array_len ( fx, place) ;
710710 lval. write_cvalue ( fx, CValue :: by_val ( len, usize_layout) ) ;
@@ -749,7 +749,7 @@ fn codegen_stmt<'tcx>(
749749 CValue :: const_val ( fx, fx. layout_of ( fx. tcx . types . usize ) , ty_size. into ( ) ) ;
750750 lval. write_cvalue ( fx, val) ;
751751 }
752- Rvalue :: Aggregate ( kind, operands) => match * * kind {
752+ Rvalue :: Aggregate ( ref kind, ref operands) => match kind. as_ref ( ) {
753753 AggregateKind :: Array ( _ty) => {
754754 for ( i, operand) in operands. iter ( ) . enumerate ( ) {
755755 let operand = codegen_operand ( fx, operand) ;
@@ -877,8 +877,7 @@ fn codegen_array_len<'tcx>(
877877 match * place. layout ( ) . ty . kind ( ) {
878878 ty:: Array ( _elem_ty, len) => {
879879 let len = fx
880- . monomorphize ( & len)
881- . eval ( fx. tcx , ParamEnv :: reveal_all ( ) )
880+ . monomorphize ( len)
882881 . eval_usize ( fx. tcx , ParamEnv :: reveal_all ( ) ) as i64 ;
883882 fx. bcx . ins ( ) . iconst ( fx. pointer_type , len)
884883 }
0 commit comments