@@ -4,7 +4,7 @@ use rustc_apfloat::ieee::{Double, Single};
44use rustc_apfloat:: { Float , FloatConvert } ;
55use rustc_middle:: mir:: interpret:: { InterpResult , PointerArithmetic , Scalar } ;
66use rustc_middle:: mir:: CastKind ;
7- use rustc_middle:: ty:: adjustment:: PointerCast ;
7+ use rustc_middle:: ty:: adjustment:: PointerCoercion ;
88use rustc_middle:: ty:: layout:: { IntegerExt , LayoutOf , TyAndLayout } ;
99use rustc_middle:: ty:: { self , FloatTy , Ty , TypeAndMut } ;
1010use rustc_target:: abi:: Integer ;
@@ -24,51 +24,52 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
2424 cast_ty : Ty < ' tcx > ,
2525 dest : & PlaceTy < ' tcx , M :: Provenance > ,
2626 ) -> InterpResult < ' tcx > {
27- use rustc_middle:: mir:: CastKind :: * ;
2827 // FIXME: In which cases should we trigger UB when the source is uninit?
2928 match cast_kind {
30- Pointer ( PointerCast :: Unsize ) => {
29+ CastKind :: PointerCoercion ( PointerCoercion :: Unsize ) => {
3130 let cast_ty = self . layout_of ( cast_ty) ?;
3231 self . unsize_into ( src, cast_ty, dest) ?;
3332 }
3433
35- PointerExposeAddress => {
34+ CastKind :: PointerExposeAddress => {
3635 let src = self . read_immediate ( src) ?;
3736 let res = self . pointer_expose_address_cast ( & src, cast_ty) ?;
3837 self . write_immediate ( res, dest) ?;
3938 }
4039
41- PointerFromExposedAddress => {
40+ CastKind :: PointerFromExposedAddress => {
4241 let src = self . read_immediate ( src) ?;
4342 let res = self . pointer_from_exposed_address_cast ( & src, cast_ty) ?;
4443 self . write_immediate ( res, dest) ?;
4544 }
4645
47- IntToInt | IntToFloat => {
46+ CastKind :: IntToInt | CastKind :: IntToFloat => {
4847 let src = self . read_immediate ( src) ?;
4948 let res = self . int_to_int_or_float ( & src, cast_ty) ?;
5049 self . write_immediate ( res, dest) ?;
5150 }
5251
53- FloatToFloat | FloatToInt => {
52+ CastKind :: FloatToFloat | CastKind :: FloatToInt => {
5453 let src = self . read_immediate ( src) ?;
5554 let res = self . float_to_float_or_int ( & src, cast_ty) ?;
5655 self . write_immediate ( res, dest) ?;
5756 }
5857
59- FnPtrToPtr | PtrToPtr => {
58+ CastKind :: FnPtrToPtr | CastKind :: PtrToPtr => {
6059 let src = self . read_immediate ( & src) ?;
6160 let res = self . ptr_to_ptr ( & src, cast_ty) ?;
6261 self . write_immediate ( res, dest) ?;
6362 }
6463
65- Pointer ( PointerCast :: MutToConstPointer | PointerCast :: ArrayToPointer ) => {
64+ CastKind :: PointerCoercion (
65+ PointerCoercion :: MutToConstPointer | PointerCoercion :: ArrayToPointer ,
66+ ) => {
6667 // These are NOPs, but can be wide pointers.
6768 let v = self . read_immediate ( src) ?;
6869 self . write_immediate ( * v, dest) ?;
6970 }
7071
71- Pointer ( PointerCast :: ReifyFnPointer ) => {
72+ CastKind :: PointerCoercion ( PointerCoercion :: ReifyFnPointer ) => {
7273 // All reifications must be monomorphic, bail out otherwise.
7374 ensure_monomorphic_enough ( * self . tcx , src. layout . ty ) ?;
7475
@@ -90,7 +91,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
9091 }
9192 }
9293
93- Pointer ( PointerCast :: UnsafeFnPointer ) => {
94+ CastKind :: PointerCoercion ( PointerCoercion :: UnsafeFnPointer ) => {
9495 let src = self . read_immediate ( src) ?;
9596 match cast_ty. kind ( ) {
9697 ty:: FnPtr ( _) => {
@@ -101,7 +102,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
101102 }
102103 }
103104
104- Pointer ( PointerCast :: ClosureFnPointer ( _) ) => {
105+ CastKind :: PointerCoercion ( PointerCoercion :: ClosureFnPointer ( _) ) => {
105106 // All reifications must be monomorphic, bail out otherwise.
106107 ensure_monomorphic_enough ( * self . tcx , src. layout . ty ) ?;
107108
@@ -122,7 +123,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
122123 }
123124 }
124125
125- DynStar => {
126+ CastKind :: DynStar => {
126127 if let ty:: Dynamic ( data, _, ty:: DynStar ) = cast_ty. kind ( ) {
127128 // Initial cast from sized to dyn trait
128129 let vtable = self . get_vtable_ptr ( src. layout . ty , data. principal ( ) ) ?;
@@ -136,7 +137,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
136137 }
137138 }
138139
139- Transmute => {
140+ CastKind :: Transmute => {
140141 assert ! ( src. layout. is_sized( ) ) ;
141142 assert ! ( dest. layout. is_sized( ) ) ;
142143 if src. layout . size != dest. layout . size {
0 commit comments