@@ -449,43 +449,43 @@ fn codegen_stmt<'tcx>(
449449 StatementKind :: Assign ( to_place_and_rval) => {
450450 let lval = codegen_place ( fx, to_place_and_rval. 0 ) ;
451451 let dest_layout = lval. layout ( ) ;
452- match & to_place_and_rval. 1 {
453- Rvalue :: Use ( operand) => {
452+ match to_place_and_rval. 1 {
453+ Rvalue :: Use ( ref operand) => {
454454 let val = codegen_operand ( fx, operand) ;
455455 lval. write_cvalue ( fx, val) ;
456456 }
457457 Rvalue :: Ref ( _, _, place) | Rvalue :: AddressOf ( _, place) => {
458- let place = codegen_place ( fx, * place) ;
458+ let place = codegen_place ( fx, place) ;
459459 let ref_ = place. place_ref ( fx, lval. layout ( ) ) ;
460460 lval. write_cvalue ( fx, ref_) ;
461461 }
462462 Rvalue :: ThreadLocalRef ( def_id) => {
463- let val = crate :: constant:: codegen_tls_ref ( fx, * def_id, lval. layout ( ) ) ;
463+ let val = crate :: constant:: codegen_tls_ref ( fx, def_id, lval. layout ( ) ) ;
464464 lval. write_cvalue ( fx, val) ;
465465 }
466- Rvalue :: BinaryOp ( bin_op, lhs, rhs) => {
466+ Rvalue :: BinaryOp ( bin_op, ref lhs, ref rhs) => {
467467 let lhs = codegen_operand ( fx, lhs) ;
468468 let rhs = codegen_operand ( fx, rhs) ;
469469
470- let res = crate :: num:: codegen_binop ( fx, * bin_op, lhs, rhs) ;
470+ let res = crate :: num:: codegen_binop ( fx, bin_op, lhs, rhs) ;
471471 lval. write_cvalue ( fx, res) ;
472472 }
473- Rvalue :: CheckedBinaryOp ( bin_op, lhs, rhs) => {
473+ Rvalue :: CheckedBinaryOp ( bin_op, ref lhs, ref rhs) => {
474474 let lhs = codegen_operand ( fx, lhs) ;
475475 let rhs = codegen_operand ( fx, rhs) ;
476476
477477 let res = if !fx. tcx . sess . overflow_checks ( ) {
478478 let val =
479- crate :: num:: codegen_int_binop ( fx, * bin_op, lhs, rhs) . load_scalar ( fx) ;
479+ crate :: num:: codegen_int_binop ( fx, bin_op, lhs, rhs) . load_scalar ( fx) ;
480480 let is_overflow = fx. bcx . ins ( ) . iconst ( types:: I8 , 0 ) ;
481481 CValue :: by_val_pair ( val, is_overflow, lval. layout ( ) )
482482 } else {
483- crate :: num:: codegen_checked_int_binop ( fx, * bin_op, lhs, rhs)
483+ crate :: num:: codegen_checked_int_binop ( fx, bin_op, lhs, rhs)
484484 } ;
485485
486486 lval. write_cvalue ( fx, res) ;
487487 }
488- Rvalue :: UnaryOp ( un_op, operand) => {
488+ Rvalue :: UnaryOp ( un_op, ref operand) => {
489489 let operand = codegen_operand ( fx, operand) ;
490490 let layout = operand. layout ( ) ;
491491 let val = operand. load_scalar ( fx) ;
@@ -514,8 +514,8 @@ fn codegen_stmt<'tcx>(
514514 } ;
515515 lval. write_cvalue ( fx, res) ;
516516 }
517- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ReifyFnPointer ) , operand, to_ty) => {
518- let from_ty = fx. monomorphize ( & operand. ty ( & fx. mir . local_decls , fx. tcx ) ) ;
517+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ReifyFnPointer ) , ref operand, to_ty) => {
518+ let from_ty = fx. monomorphize ( operand. ty ( & fx. mir . local_decls , fx. tcx ) ) ;
519519 let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
520520 match * from_ty. kind ( ) {
521521 ty:: FnDef ( def_id, substs) => {
@@ -535,14 +535,14 @@ fn codegen_stmt<'tcx>(
535535 _ => bug ! ( "Trying to ReifyFnPointer on non FnDef {:?}" , from_ty) ,
536536 }
537537 }
538- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: UnsafeFnPointer ) , operand, to_ty)
539- | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: MutToConstPointer ) , operand, to_ty)
540- | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ArrayToPointer ) , operand, to_ty) => {
538+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: UnsafeFnPointer ) , ref operand, to_ty)
539+ | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: MutToConstPointer ) , ref operand, to_ty)
540+ | Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: ArrayToPointer ) , ref operand, to_ty) => {
541541 let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
542542 let operand = codegen_operand ( fx, operand) ;
543543 lval. write_cvalue ( fx, operand. cast_pointer_to ( to_layout) ) ;
544544 }
545- Rvalue :: Cast ( CastKind :: Misc , operand, to_ty) => {
545+ Rvalue :: Cast ( CastKind :: Misc , ref operand, to_ty) => {
546546 let operand = codegen_operand ( fx, operand) ;
547547 let from_ty = operand. layout ( ) . ty ;
548548 let to_ty = fx. monomorphize ( to_ty) ;
@@ -582,12 +582,12 @@ fn codegen_stmt<'tcx>(
582582
583583 use rustc_target:: abi:: { Int , TagEncoding , Variants } ;
584584
585- match & operand. layout ( ) . variants {
585+ match operand. layout ( ) . variants {
586586 Variants :: Single { index } => {
587587 let discr = operand
588588 . layout ( )
589589 . ty
590- . discriminant_for_variant ( fx. tcx , * index)
590+ . discriminant_for_variant ( fx. tcx , index)
591591 . unwrap ( ) ;
592592 let discr = if discr. ty . is_signed ( ) {
593593 fx. layout_of ( discr. ty ) . size . sign_extend ( discr. val )
@@ -600,7 +600,7 @@ fn codegen_stmt<'tcx>(
600600 lval. write_cvalue ( fx, discr) ;
601601 }
602602 Variants :: Multiple {
603- tag,
603+ ref tag,
604604 tag_field,
605605 tag_encoding : TagEncoding :: Direct ,
606606 variants : _,
@@ -609,7 +609,7 @@ fn codegen_stmt<'tcx>(
609609
610610 // Read the tag/niche-encoded discriminant from memory.
611611 let encoded_discr =
612- operand. value_field ( fx, mir:: Field :: new ( * tag_field) ) ;
612+ operand. value_field ( fx, mir:: Field :: new ( tag_field) ) ;
613613 let encoded_discr = encoded_discr. load_scalar ( fx) ;
614614
615615 // Decode the discriminant (specifically if it's niche-encoded).
@@ -639,7 +639,7 @@ fn codegen_stmt<'tcx>(
639639 }
640640 Rvalue :: Cast (
641641 CastKind :: Pointer ( PointerCast :: ClosureFnPointer ( _) ) ,
642- operand,
642+ ref operand,
643643 _to_ty,
644644 ) => {
645645 let operand = codegen_operand ( fx, operand) ;
@@ -659,18 +659,18 @@ fn codegen_stmt<'tcx>(
659659 _ => bug ! ( "{} cannot be cast to a fn ptr" , operand. layout( ) . ty) ,
660660 }
661661 }
662- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , operand, _to_ty) => {
662+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , ref operand, _to_ty) => {
663663 let operand = codegen_operand ( fx, operand) ;
664664 operand. unsize_value ( fx, lval) ;
665665 }
666666 Rvalue :: Discriminant ( place) => {
667- let place = codegen_place ( fx, * place) ;
667+ let place = codegen_place ( fx, place) ;
668668 let value = place. to_cvalue ( fx) ;
669669 let discr =
670670 crate :: discriminant:: codegen_get_discriminant ( fx, value, dest_layout) ;
671671 lval. write_cvalue ( fx, discr) ;
672672 }
673- Rvalue :: Repeat ( operand, times) => {
673+ Rvalue :: Repeat ( ref operand, times) => {
674674 let operand = codegen_operand ( fx, operand) ;
675675 let times = fx
676676 . monomorphize ( times)
@@ -709,7 +709,7 @@ fn codegen_stmt<'tcx>(
709709 }
710710 }
711711 Rvalue :: Len ( place) => {
712- let place = codegen_place ( fx, * place) ;
712+ let place = codegen_place ( fx, place) ;
713713 let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
714714 let len = codegen_array_len ( fx, place) ;
715715 lval. write_cvalue ( fx, CValue :: by_val ( len, usize_layout) ) ;
@@ -754,7 +754,7 @@ fn codegen_stmt<'tcx>(
754754 CValue :: const_val ( fx, fx. layout_of ( fx. tcx . types . usize ) , ty_size. into ( ) ) ;
755755 lval. write_cvalue ( fx, val) ;
756756 }
757- Rvalue :: Aggregate ( kind, operands) => match * * kind {
757+ Rvalue :: Aggregate ( ref kind, ref operands) => match kind. as_ref ( ) {
758758 AggregateKind :: Array ( _ty) => {
759759 for ( i, operand) in operands. iter ( ) . enumerate ( ) {
760760 let operand = codegen_operand ( fx, operand) ;
@@ -882,8 +882,7 @@ fn codegen_array_len<'tcx>(
882882 match * place. layout ( ) . ty . kind ( ) {
883883 ty:: Array ( _elem_ty, len) => {
884884 let len = fx
885- . monomorphize ( & len)
886- . eval ( fx. tcx , ParamEnv :: reveal_all ( ) )
885+ . monomorphize ( len)
887886 . eval_usize ( fx. tcx , ParamEnv :: reveal_all ( ) ) as i64 ;
888887 fx. bcx . ins ( ) . iconst ( fx. pointer_type , len)
889888 }
0 commit comments