@@ -57,7 +57,9 @@ use rustc::hir::def_id::DefId;
5757use rustc:: infer:: { Coercion , InferResult , InferOk } ;
5858use rustc:: infer:: type_variable:: TypeVariableOrigin ;
5959use rustc:: traits:: { self , ObligationCause , ObligationCauseCode } ;
60- use rustc:: ty:: adjustment:: { Adjustment , Adjust , AllowTwoPhase , AutoBorrow , AutoBorrowMutability } ;
60+ use rustc:: ty:: adjustment:: {
61+ Adjustment , Adjust , AllowTwoPhase , AutoBorrow , AutoBorrowMutability , PointerCast
62+ } ;
6163use rustc:: ty:: { self , TypeAndMut , Ty , ClosureSubsts } ;
6264use rustc:: ty:: fold:: TypeFoldable ;
6365use rustc:: ty:: error:: TypeError ;
@@ -512,7 +514,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
512514 let coerce_target = self . next_ty_var ( origin) ;
513515 let mut coercion = self . unify_and ( coerce_target, target, |target| {
514516 let unsize = Adjustment {
515- kind : Adjust :: Unsize ,
517+ kind : Adjust :: Pointer ( PointerCast :: Unsize ) ,
516518 target
517519 } ;
518520 match reborrow {
@@ -661,7 +663,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
661663 debug ! ( "coerce_from_fn_pointer(a={:?}, b={:?})" , a, b) ;
662664
663665 self . coerce_from_safe_fn ( a, fn_ty_a, b,
664- simple ( Adjust :: UnsafeFnPointer ) , identity)
666+ simple ( Adjust :: Pointer ( PointerCast :: UnsafeFnPointer ) ) , identity)
665667 }
666668
667669 fn coerce_from_fn_item ( & self ,
@@ -687,11 +689,17 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
687689 b,
688690 |unsafe_ty| {
689691 vec ! [
690- Adjustment { kind: Adjust :: ReifyFnPointer , target: a_fn_pointer } ,
691- Adjustment { kind: Adjust :: UnsafeFnPointer , target: unsafe_ty } ,
692+ Adjustment {
693+ kind: Adjust :: Pointer ( PointerCast :: ReifyFnPointer ) ,
694+ target: a_fn_pointer
695+ } ,
696+ Adjustment {
697+ kind: Adjust :: Pointer ( PointerCast :: UnsafeFnPointer ) ,
698+ target: unsafe_ty
699+ } ,
692700 ]
693701 } ,
694- simple ( Adjust :: ReifyFnPointer )
702+ simple ( Adjust :: Pointer ( PointerCast :: ReifyFnPointer ) )
695703 ) ?;
696704
697705 obligations. extend ( o2) ;
@@ -727,7 +735,9 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
727735 let pointer_ty = self . tcx . coerce_closure_fn_ty ( sig, unsafety) ;
728736 debug ! ( "coerce_closure_to_fn(a={:?}, b={:?}, pty={:?})" ,
729737 a, b, pointer_ty) ;
730- self . unify_and ( pointer_ty, b, simple ( Adjust :: ClosureFnPointer ( unsafety) ) )
738+ self . unify_and ( pointer_ty, b, simple (
739+ Adjust :: Pointer ( PointerCast :: ClosureFnPointer ( unsafety) )
740+ ) )
731741 }
732742 _ => self . unify_and ( a, b, identity) ,
733743 }
@@ -766,7 +776,9 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
766776 } ]
767777 } )
768778 } else if mt_a. mutbl != mutbl_b {
769- self . unify_and ( a_unsafe, b, simple ( Adjust :: MutToConstPointer ) )
779+ self . unify_and (
780+ a_unsafe, b, simple ( Adjust :: Pointer ( PointerCast :: MutToConstPointer ) )
781+ )
770782 } else {
771783 self . unify_and ( a_unsafe, b, identity)
772784 }
@@ -857,7 +869,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
857869 // The only adjustment that can produce an fn item is
858870 // `NeverToAny`, so this should always be valid.
859871 self . apply_adjustments ( expr, vec ! [ Adjustment {
860- kind: Adjust :: ReifyFnPointer ,
872+ kind: Adjust :: Pointer ( PointerCast :: ReifyFnPointer ) ,
861873 target: fn_ptr
862874 } ] ) ;
863875 }
0 commit comments