@@ -55,7 +55,7 @@ use rustc_middle::ty::adjustment::{
5555use rustc_middle:: ty:: error:: TypeError ;
5656use rustc_middle:: ty:: relate:: RelateResult ;
5757use rustc_middle:: ty:: visit:: TypeVisitableExt ;
58- use rustc_middle:: ty:: { self , GenericArgsRef , Ty , TyCtxt , TypeAndMut } ;
58+ use rustc_middle:: ty:: { self , GenericArgsRef , Ty , TyCtxt } ;
5959use rustc_session:: parse:: feature_err;
6060use rustc_span:: symbol:: sym;
6161use rustc_span:: DesugaringKind ;
@@ -440,10 +440,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
440440 let derefd_ty_a = Ty :: new_ref (
441441 self . tcx ,
442442 r,
443- TypeAndMut {
444- ty : referent_ty,
445- mutbl : mutbl_b, // [1] above
446- } ,
443+ referent_ty,
444+ mutbl_b, // [1] above
447445 ) ;
448446 match self . unify ( derefd_ty_a, b) {
449447 Ok ( ok) => {
@@ -558,11 +556,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
558556 Adjustment { kind : Adjust :: Deref ( None ) , target : ty_a } ,
559557 Adjustment {
560558 kind : Adjust :: Borrow ( AutoBorrow :: Ref ( r_borrow, mutbl) ) ,
561- target : Ty :: new_ref (
562- self . tcx ,
563- r_borrow,
564- ty:: TypeAndMut { mutbl : mutbl_b, ty : ty_a } ,
565- ) ,
559+ target : Ty :: new_ref ( self . tcx , r_borrow, ty_a, mutbl_b) ,
566560 } ,
567561 ) )
568562 }
@@ -573,7 +567,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
573567 Adjustment { kind : Adjust :: Deref ( None ) , target : ty_a } ,
574568 Adjustment {
575569 kind : Adjust :: Borrow ( AutoBorrow :: RawPtr ( mt_b) ) ,
576- target : Ty :: new_ptr ( self . tcx , ty :: TypeAndMut { mutbl : mt_b , ty : ty_a } ) ,
570+ target : Ty :: new_ptr ( self . tcx , ty_a , mt_b ) ,
577571 } ,
578572 ) )
579573 }
@@ -990,7 +984,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
990984 coerce_mutbls ( mt_a. mutbl , mutbl_b) ?;
991985
992986 // Check that the types which they point at are compatible.
993- let a_unsafe = Ty :: new_ptr ( self . tcx , ty :: TypeAndMut { mutbl : mutbl_b , ty : mt_a. ty } ) ;
987+ let a_unsafe = Ty :: new_ptr ( self . tcx , mt_a. ty , mutbl_b ) ;
994988 // Although references and unsafe ptrs have the same
995989 // representation, we still register an Adjust::DerefRef so that
996990 // regionck knows that the region for `a` must be valid here.
0 commit comments