@@ -445,43 +445,43 @@ fn codegen_stmt<'tcx>(
445
445
StatementKind :: Assign ( to_place_and_rval) => {
446
446
let lval = codegen_place ( fx, to_place_and_rval. 0 ) ;
447
447
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) => {
450
450
let val = codegen_operand ( fx, operand) ;
451
451
lval. write_cvalue ( fx, val) ;
452
452
}
453
453
Rvalue :: Ref ( _, _, place) | Rvalue :: AddressOf ( _, place) => {
454
- let place = codegen_place ( fx, * place) ;
454
+ let place = codegen_place ( fx, place) ;
455
455
let ref_ = place. place_ref ( fx, lval. layout ( ) ) ;
456
456
lval. write_cvalue ( fx, ref_) ;
457
457
}
458
458
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 ( ) ) ;
460
460
lval. write_cvalue ( fx, val) ;
461
461
}
462
- Rvalue :: BinaryOp ( bin_op, lhs, rhs) => {
462
+ Rvalue :: BinaryOp ( bin_op, ref lhs, ref rhs) => {
463
463
let lhs = codegen_operand ( fx, lhs) ;
464
464
let rhs = codegen_operand ( fx, rhs) ;
465
465
466
- let res = crate :: num:: codegen_binop ( fx, * bin_op, lhs, rhs) ;
466
+ let res = crate :: num:: codegen_binop ( fx, bin_op, lhs, rhs) ;
467
467
lval. write_cvalue ( fx, res) ;
468
468
}
469
- Rvalue :: CheckedBinaryOp ( bin_op, lhs, rhs) => {
469
+ Rvalue :: CheckedBinaryOp ( bin_op, ref lhs, ref rhs) => {
470
470
let lhs = codegen_operand ( fx, lhs) ;
471
471
let rhs = codegen_operand ( fx, rhs) ;
472
472
473
473
let res = if !fx. tcx . sess . overflow_checks ( ) {
474
474
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) ;
476
476
let is_overflow = fx. bcx . ins ( ) . iconst ( types:: I8 , 0 ) ;
477
477
CValue :: by_val_pair ( val, is_overflow, lval. layout ( ) )
478
478
} 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)
480
480
} ;
481
481
482
482
lval. write_cvalue ( fx, res) ;
483
483
}
484
- Rvalue :: UnaryOp ( un_op, operand) => {
484
+ Rvalue :: UnaryOp ( un_op, ref operand) => {
485
485
let operand = codegen_operand ( fx, operand) ;
486
486
let layout = operand. layout ( ) ;
487
487
let val = operand. load_scalar ( fx) ;
@@ -509,8 +509,8 @@ fn codegen_stmt<'tcx>(
509
509
} ;
510
510
lval. write_cvalue ( fx, res) ;
511
511
}
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 ) ) ;
514
514
let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
515
515
match * from_ty. kind ( ) {
516
516
ty:: FnDef ( def_id, substs) => {
@@ -530,14 +530,14 @@ fn codegen_stmt<'tcx>(
530
530
_ => bug ! ( "Trying to ReifyFnPointer on non FnDef {:?}" , from_ty) ,
531
531
}
532
532
}
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) => {
536
536
let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
537
537
let operand = codegen_operand ( fx, operand) ;
538
538
lval. write_cvalue ( fx, operand. cast_pointer_to ( to_layout) ) ;
539
539
}
540
- Rvalue :: Cast ( CastKind :: Misc , operand, to_ty) => {
540
+ Rvalue :: Cast ( CastKind :: Misc , ref operand, to_ty) => {
541
541
let operand = codegen_operand ( fx, operand) ;
542
542
let from_ty = operand. layout ( ) . ty ;
543
543
let to_ty = fx. monomorphize ( to_ty) ;
@@ -577,12 +577,12 @@ fn codegen_stmt<'tcx>(
577
577
578
578
use rustc_target:: abi:: { Int , TagEncoding , Variants } ;
579
579
580
- match & operand. layout ( ) . variants {
580
+ match operand. layout ( ) . variants {
581
581
Variants :: Single { index } => {
582
582
let discr = operand
583
583
. layout ( )
584
584
. ty
585
- . discriminant_for_variant ( fx. tcx , * index)
585
+ . discriminant_for_variant ( fx. tcx , index)
586
586
. unwrap ( ) ;
587
587
let discr = if discr. ty . is_signed ( ) {
588
588
fx. layout_of ( discr. ty ) . size . sign_extend ( discr. val )
@@ -595,7 +595,7 @@ fn codegen_stmt<'tcx>(
595
595
lval. write_cvalue ( fx, discr) ;
596
596
}
597
597
Variants :: Multiple {
598
- tag,
598
+ ref tag,
599
599
tag_field,
600
600
tag_encoding : TagEncoding :: Direct ,
601
601
variants : _,
@@ -604,7 +604,7 @@ fn codegen_stmt<'tcx>(
604
604
605
605
// Read the tag/niche-encoded discriminant from memory.
606
606
let encoded_discr =
607
- operand. value_field ( fx, mir:: Field :: new ( * tag_field) ) ;
607
+ operand. value_field ( fx, mir:: Field :: new ( tag_field) ) ;
608
608
let encoded_discr = encoded_discr. load_scalar ( fx) ;
609
609
610
610
// Decode the discriminant (specifically if it's niche-encoded).
@@ -634,7 +634,7 @@ fn codegen_stmt<'tcx>(
634
634
}
635
635
Rvalue :: Cast (
636
636
CastKind :: Pointer ( PointerCast :: ClosureFnPointer ( _) ) ,
637
- operand,
637
+ ref operand,
638
638
_to_ty,
639
639
) => {
640
640
let operand = codegen_operand ( fx, operand) ;
@@ -654,18 +654,18 @@ fn codegen_stmt<'tcx>(
654
654
_ => bug ! ( "{} cannot be cast to a fn ptr" , operand. layout( ) . ty) ,
655
655
}
656
656
}
657
- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , operand, _to_ty) => {
657
+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , ref operand, _to_ty) => {
658
658
let operand = codegen_operand ( fx, operand) ;
659
659
operand. unsize_value ( fx, lval) ;
660
660
}
661
661
Rvalue :: Discriminant ( place) => {
662
- let place = codegen_place ( fx, * place) ;
662
+ let place = codegen_place ( fx, place) ;
663
663
let value = place. to_cvalue ( fx) ;
664
664
let discr =
665
665
crate :: discriminant:: codegen_get_discriminant ( fx, value, dest_layout) ;
666
666
lval. write_cvalue ( fx, discr) ;
667
667
}
668
- Rvalue :: Repeat ( operand, times) => {
668
+ Rvalue :: Repeat ( ref operand, times) => {
669
669
let operand = codegen_operand ( fx, operand) ;
670
670
let times = fx
671
671
. monomorphize ( times)
@@ -704,7 +704,7 @@ fn codegen_stmt<'tcx>(
704
704
}
705
705
}
706
706
Rvalue :: Len ( place) => {
707
- let place = codegen_place ( fx, * place) ;
707
+ let place = codegen_place ( fx, place) ;
708
708
let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
709
709
let len = codegen_array_len ( fx, place) ;
710
710
lval. write_cvalue ( fx, CValue :: by_val ( len, usize_layout) ) ;
@@ -749,7 +749,7 @@ fn codegen_stmt<'tcx>(
749
749
CValue :: const_val ( fx, fx. layout_of ( fx. tcx . types . usize ) , ty_size. into ( ) ) ;
750
750
lval. write_cvalue ( fx, val) ;
751
751
}
752
- Rvalue :: Aggregate ( kind, operands) => match * * kind {
752
+ Rvalue :: Aggregate ( ref kind, ref operands) => match kind. as_ref ( ) {
753
753
AggregateKind :: Array ( _ty) => {
754
754
for ( i, operand) in operands. iter ( ) . enumerate ( ) {
755
755
let operand = codegen_operand ( fx, operand) ;
@@ -877,8 +877,7 @@ fn codegen_array_len<'tcx>(
877
877
match * place. layout ( ) . ty . kind ( ) {
878
878
ty:: Array ( _elem_ty, len) => {
879
879
let len = fx
880
- . monomorphize ( & len)
881
- . eval ( fx. tcx , ParamEnv :: reveal_all ( ) )
880
+ . monomorphize ( len)
882
881
. eval_usize ( fx. tcx , ParamEnv :: reveal_all ( ) ) as i64 ;
883
882
fx. bcx . ins ( ) . iconst ( fx. pointer_type , len)
884
883
}
0 commit comments