@@ -55,7 +55,7 @@ use rustc_middle::ty::adjustment::{
55
55
use rustc_middle:: ty:: error:: TypeError ;
56
56
use rustc_middle:: ty:: relate:: RelateResult ;
57
57
use rustc_middle:: ty:: visit:: TypeVisitableExt ;
58
- use rustc_middle:: ty:: { self , GenericArgsRef , Ty , TyCtxt , TypeAndMut } ;
58
+ use rustc_middle:: ty:: { self , GenericArgsRef , Ty , TyCtxt } ;
59
59
use rustc_session:: parse:: feature_err;
60
60
use rustc_span:: symbol:: sym;
61
61
use rustc_span:: DesugaringKind ;
@@ -440,10 +440,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
440
440
let derefd_ty_a = Ty :: new_ref (
441
441
self . tcx ,
442
442
r,
443
- TypeAndMut {
444
- ty : referent_ty,
445
- mutbl : mutbl_b, // [1] above
446
- } ,
443
+ referent_ty,
444
+ mutbl_b, // [1] above
447
445
) ;
448
446
match self . unify ( derefd_ty_a, b) {
449
447
Ok ( ok) => {
@@ -558,11 +556,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
558
556
Adjustment { kind : Adjust :: Deref ( None ) , target : ty_a } ,
559
557
Adjustment {
560
558
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) ,
566
560
} ,
567
561
) )
568
562
}
@@ -573,7 +567,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
573
567
Adjustment { kind : Adjust :: Deref ( None ) , target : ty_a } ,
574
568
Adjustment {
575
569
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 ) ,
577
571
} ,
578
572
) )
579
573
}
@@ -990,7 +984,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
990
984
coerce_mutbls ( mt_a. mutbl , mutbl_b) ?;
991
985
992
986
// 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 ) ;
994
988
// Although references and unsafe ptrs have the same
995
989
// representation, we still register an Adjust::DerefRef so that
996
990
// regionck knows that the region for `a` must be valid here.
0 commit comments