22
33use rustc_ast:: InlineAsmOptions ;
44use rustc_index:: IndexVec ;
5- use rustc_middle:: ty:: adjustment:: PointerCast ;
5+ use rustc_middle:: ty:: adjustment:: PointerCoercion ;
66use rustc_middle:: ty:: layout:: FnAbiOf ;
77use rustc_middle:: ty:: print:: with_no_trimmed_paths;
88
@@ -592,7 +592,7 @@ fn codegen_stmt<'tcx>(
592592 lval. write_cvalue ( fx, res) ;
593593 }
594594 Rvalue :: Cast (
595- CastKind :: Pointer ( PointerCast :: ReifyFnPointer ) ,
595+ CastKind :: PointerCoercion ( PointerCoercion :: ReifyFnPointer ) ,
596596 ref operand,
597597 to_ty,
598598 ) => {
@@ -617,17 +617,17 @@ fn codegen_stmt<'tcx>(
617617 }
618618 }
619619 Rvalue :: Cast (
620- CastKind :: Pointer ( PointerCast :: UnsafeFnPointer ) ,
620+ CastKind :: PointerCoercion ( PointerCoercion :: UnsafeFnPointer ) ,
621621 ref operand,
622622 to_ty,
623623 )
624624 | Rvalue :: Cast (
625- CastKind :: Pointer ( PointerCast :: MutToConstPointer ) ,
625+ CastKind :: PointerCoercion ( PointerCoercion :: MutToConstPointer ) ,
626626 ref operand,
627627 to_ty,
628628 )
629629 | Rvalue :: Cast (
630- CastKind :: Pointer ( PointerCast :: ArrayToPointer ) ,
630+ CastKind :: PointerCoercion ( PointerCoercion :: ArrayToPointer ) ,
631631 ref operand,
632632 to_ty,
633633 ) => {
@@ -683,7 +683,7 @@ fn codegen_stmt<'tcx>(
683683 }
684684 }
685685 Rvalue :: Cast (
686- CastKind :: Pointer ( PointerCast :: ClosureFnPointer ( _) ) ,
686+ CastKind :: PointerCoercion ( PointerCoercion :: ClosureFnPointer ( _) ) ,
687687 ref operand,
688688 _to_ty,
689689 ) => {
@@ -705,7 +705,11 @@ fn codegen_stmt<'tcx>(
705705 _ => bug ! ( "{} cannot be cast to a fn ptr" , operand. layout( ) . ty) ,
706706 }
707707 }
708- Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , ref operand, _to_ty) => {
708+ Rvalue :: Cast (
709+ CastKind :: PointerCoercion ( PointerCoercion :: Unsize ) ,
710+ ref operand,
711+ _to_ty,
712+ ) => {
709713 let operand = codegen_operand ( fx, operand) ;
710714 crate :: unsize:: coerce_unsized_into ( fx, operand, lval) ;
711715 }
@@ -727,7 +731,6 @@ fn codegen_stmt<'tcx>(
727731 let times = fx
728732 . monomorphize ( times)
729733 . eval ( fx. tcx , ParamEnv :: reveal_all ( ) )
730- . kind ( )
731734 . try_to_bits ( fx. tcx . data_layout . pointer_size )
732735 . unwrap ( ) ;
733736 if operand. layout ( ) . size . bytes ( ) == 0 {
@@ -768,7 +771,7 @@ fn codegen_stmt<'tcx>(
768771 }
769772 Rvalue :: ShallowInitBox ( ref operand, content_ty) => {
770773 let content_ty = fx. monomorphize ( content_ty) ;
771- let box_layout = fx. layout_of ( fx. tcx . mk_box ( content_ty) ) ;
774+ let box_layout = fx. layout_of ( Ty :: new_box ( fx. tcx , content_ty) ) ;
772775 let operand = codegen_operand ( fx, operand) ;
773776 let operand = operand. load_scalar ( fx) ;
774777 lval. write_cvalue ( fx, CValue :: by_val ( operand, box_layout) ) ;
@@ -909,7 +912,7 @@ pub(crate) fn codegen_place<'tcx>(
909912 let ptr = cplace. to_ptr ( ) ;
910913 cplace = CPlace :: for_ptr (
911914 ptr. offset_i64 ( fx, elem_layout. size . bytes ( ) as i64 * ( from as i64 ) ) ,
912- fx. layout_of ( fx. tcx . mk_array ( * elem_ty, to - from) ) ,
915+ fx. layout_of ( Ty :: new_array ( fx. tcx , * elem_ty, to - from) ) ,
913916 ) ;
914917 }
915918 ty:: Slice ( elem_ty) => {
0 commit comments