@@ -449,43 +449,43 @@ fn codegen_stmt<'tcx>(
449
449
StatementKind :: Assign ( to_place_and_rval) => {
450
450
let lval = codegen_place ( fx, to_place_and_rval. 0 ) ;
451
451
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) => {
454
454
let val = codegen_operand ( fx, operand) ;
455
455
lval. write_cvalue ( fx, val) ;
456
456
}
457
457
Rvalue :: Ref ( _, _, place) | Rvalue :: AddressOf ( _, place) => {
458
- let place = codegen_place ( fx, * place) ;
458
+ let place = codegen_place ( fx, place) ;
459
459
let ref_ = place. place_ref ( fx, lval. layout ( ) ) ;
460
460
lval. write_cvalue ( fx, ref_) ;
461
461
}
462
462
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 ( ) ) ;
464
464
lval. write_cvalue ( fx, val) ;
465
465
}
466
- Rvalue :: BinaryOp ( bin_op, lhs, rhs) => {
466
+ Rvalue :: BinaryOp ( bin_op, ref lhs, ref rhs) => {
467
467
let lhs = codegen_operand ( fx, lhs) ;
468
468
let rhs = codegen_operand ( fx, rhs) ;
469
469
470
- let res = crate :: num:: codegen_binop ( fx, * bin_op, lhs, rhs) ;
470
+ let res = crate :: num:: codegen_binop ( fx, bin_op, lhs, rhs) ;
471
471
lval. write_cvalue ( fx, res) ;
472
472
}
473
- Rvalue :: CheckedBinaryOp ( bin_op, lhs, rhs) => {
473
+ Rvalue :: CheckedBinaryOp ( bin_op, ref lhs, ref rhs) => {
474
474
let lhs = codegen_operand ( fx, lhs) ;
475
475
let rhs = codegen_operand ( fx, rhs) ;
476
476
477
477
let res = if !fx. tcx . sess . overflow_checks ( ) {
478
478
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) ;
480
480
let is_overflow = fx. bcx . ins ( ) . iconst ( types:: I8 , 0 ) ;
481
481
CValue :: by_val_pair ( val, is_overflow, lval. layout ( ) )
482
482
} 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)
484
484
} ;
485
485
486
486
lval. write_cvalue ( fx, res) ;
487
487
}
488
- Rvalue :: UnaryOp ( un_op, operand) => {
488
+ Rvalue :: UnaryOp ( un_op, ref operand) => {
489
489
let operand = codegen_operand ( fx, operand) ;
490
490
let layout = operand. layout ( ) ;
491
491
let val = operand. load_scalar ( fx) ;
@@ -514,8 +514,8 @@ fn codegen_stmt<'tcx>(
514
514
} ;
515
515
lval. write_cvalue ( fx, res) ;
516
516
}
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 ) ) ;
519
519
let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
520
520
match * from_ty. kind ( ) {
521
521
ty:: FnDef ( def_id, substs) => {
@@ -535,14 +535,14 @@ fn codegen_stmt<'tcx>(
535
535
_ => bug ! ( "Trying to ReifyFnPointer on non FnDef {:?}" , from_ty) ,
536
536
}
537
537
}
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) => {
541
541
let to_layout = fx. layout_of ( fx. monomorphize ( to_ty) ) ;
542
542
let operand = codegen_operand ( fx, operand) ;
543
543
lval. write_cvalue ( fx, operand. cast_pointer_to ( to_layout) ) ;
544
544
}
545
- Rvalue :: Cast ( CastKind :: Misc , operand, to_ty) => {
545
+ Rvalue :: Cast ( CastKind :: Misc , ref operand, to_ty) => {
546
546
let operand = codegen_operand ( fx, operand) ;
547
547
let from_ty = operand. layout ( ) . ty ;
548
548
let to_ty = fx. monomorphize ( to_ty) ;
@@ -582,12 +582,12 @@ fn codegen_stmt<'tcx>(
582
582
583
583
use rustc_target:: abi:: { Int , TagEncoding , Variants } ;
584
584
585
- match & operand. layout ( ) . variants {
585
+ match operand. layout ( ) . variants {
586
586
Variants :: Single { index } => {
587
587
let discr = operand
588
588
. layout ( )
589
589
. ty
590
- . discriminant_for_variant ( fx. tcx , * index)
590
+ . discriminant_for_variant ( fx. tcx , index)
591
591
. unwrap ( ) ;
592
592
let discr = if discr. ty . is_signed ( ) {
593
593
fx. layout_of ( discr. ty ) . size . sign_extend ( discr. val )
@@ -600,7 +600,7 @@ fn codegen_stmt<'tcx>(
600
600
lval. write_cvalue ( fx, discr) ;
601
601
}
602
602
Variants :: Multiple {
603
- tag,
603
+ ref tag,
604
604
tag_field,
605
605
tag_encoding : TagEncoding :: Direct ,
606
606
variants : _,
@@ -609,7 +609,7 @@ fn codegen_stmt<'tcx>(
609
609
610
610
// Read the tag/niche-encoded discriminant from memory.
611
611
let encoded_discr =
612
- operand. value_field ( fx, mir:: Field :: new ( * tag_field) ) ;
612
+ operand. value_field ( fx, mir:: Field :: new ( tag_field) ) ;
613
613
let encoded_discr = encoded_discr. load_scalar ( fx) ;
614
614
615
615
// Decode the discriminant (specifically if it's niche-encoded).
@@ -639,7 +639,7 @@ fn codegen_stmt<'tcx>(
639
639
}
640
640
Rvalue :: Cast (
641
641
CastKind :: Pointer ( PointerCast :: ClosureFnPointer ( _) ) ,
642
- operand,
642
+ ref operand,
643
643
_to_ty,
644
644
) => {
645
645
let operand = codegen_operand ( fx, operand) ;
@@ -659,18 +659,18 @@ fn codegen_stmt<'tcx>(
659
659
_ => bug ! ( "{} cannot be cast to a fn ptr" , operand. layout( ) . ty) ,
660
660
}
661
661
}
662
- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , operand, _to_ty) => {
662
+ Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , ref operand, _to_ty) => {
663
663
let operand = codegen_operand ( fx, operand) ;
664
664
operand. unsize_value ( fx, lval) ;
665
665
}
666
666
Rvalue :: Discriminant ( place) => {
667
- let place = codegen_place ( fx, * place) ;
667
+ let place = codegen_place ( fx, place) ;
668
668
let value = place. to_cvalue ( fx) ;
669
669
let discr =
670
670
crate :: discriminant:: codegen_get_discriminant ( fx, value, dest_layout) ;
671
671
lval. write_cvalue ( fx, discr) ;
672
672
}
673
- Rvalue :: Repeat ( operand, times) => {
673
+ Rvalue :: Repeat ( ref operand, times) => {
674
674
let operand = codegen_operand ( fx, operand) ;
675
675
let times = fx
676
676
. monomorphize ( times)
@@ -709,7 +709,7 @@ fn codegen_stmt<'tcx>(
709
709
}
710
710
}
711
711
Rvalue :: Len ( place) => {
712
- let place = codegen_place ( fx, * place) ;
712
+ let place = codegen_place ( fx, place) ;
713
713
let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
714
714
let len = codegen_array_len ( fx, place) ;
715
715
lval. write_cvalue ( fx, CValue :: by_val ( len, usize_layout) ) ;
@@ -754,7 +754,7 @@ fn codegen_stmt<'tcx>(
754
754
CValue :: const_val ( fx, fx. layout_of ( fx. tcx . types . usize ) , ty_size. into ( ) ) ;
755
755
lval. write_cvalue ( fx, val) ;
756
756
}
757
- Rvalue :: Aggregate ( kind, operands) => match * * kind {
757
+ Rvalue :: Aggregate ( ref kind, ref operands) => match kind. as_ref ( ) {
758
758
AggregateKind :: Array ( _ty) => {
759
759
for ( i, operand) in operands. iter ( ) . enumerate ( ) {
760
760
let operand = codegen_operand ( fx, operand) ;
@@ -882,8 +882,7 @@ fn codegen_array_len<'tcx>(
882
882
match * place. layout ( ) . ty . kind ( ) {
883
883
ty:: Array ( _elem_ty, len) => {
884
884
let len = fx
885
- . monomorphize ( & len)
886
- . eval ( fx. tcx , ParamEnv :: reveal_all ( ) )
885
+ . monomorphize ( len)
887
886
. eval_usize ( fx. tcx , ParamEnv :: reveal_all ( ) ) as i64 ;
888
887
fx. bcx . ins ( ) . iconst ( fx. pointer_type , len)
889
888
}
0 commit comments