@@ -110,7 +110,7 @@ pub struct CrateAnalysis {
110110#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
111111pub struct Field < ' tcx > {
112112 pub name : ast:: Name ,
113- pub mt : TypeWithMutability < ' tcx >
113+ pub mt : TypeAndMut < ' tcx >
114114}
115115
116116
@@ -487,7 +487,7 @@ pub struct AssociatedType<'tcx> {
487487}
488488
489489#[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug ) ]
490- pub struct TypeWithMutability < ' tcx > {
490+ pub struct TypeAndMut < ' tcx > {
491491 pub ty : Ty < ' tcx > ,
492492 pub mutbl : ast:: Mutability ,
493493}
@@ -1746,11 +1746,11 @@ pub enum TypeVariants<'tcx> {
17461746 TySlice ( Ty < ' tcx > ) ,
17471747
17481748 /// A raw pointer. Written as `*mut T` or `*const T`
1749- TyRawPtr ( TypeWithMutability < ' tcx > ) ,
1749+ TyRawPtr ( TypeAndMut < ' tcx > ) ,
17501750
17511751 /// A reference; a pointer with an associated lifetime. Written as
17521752 /// `&a mut T` or `&'a T`.
1753- TyRef ( & ' tcx Region , TypeWithMutability < ' tcx > ) ,
1753+ TyRef ( & ' tcx Region , TypeAndMut < ' tcx > ) ,
17541754
17551755 /// If the def-id is Some(_), then this is the type of a specific
17561756 /// fn item. Otherwise, if None(_), it a fn pointer type.
@@ -3564,28 +3564,28 @@ impl<'tcx> ctxt<'tcx> {
35643564 self . mk_ty ( TyBox ( ty) )
35653565 }
35663566
3567- pub fn mk_ptr ( & self , tm : TypeWithMutability < ' tcx > ) -> Ty < ' tcx > {
3567+ pub fn mk_ptr ( & self , tm : TypeAndMut < ' tcx > ) -> Ty < ' tcx > {
35683568 self . mk_ty ( TyRawPtr ( tm) )
35693569 }
35703570
3571- pub fn mk_ref ( & self , r : & ' tcx Region , tm : TypeWithMutability < ' tcx > ) -> Ty < ' tcx > {
3571+ pub fn mk_ref ( & self , r : & ' tcx Region , tm : TypeAndMut < ' tcx > ) -> Ty < ' tcx > {
35723572 self . mk_ty ( TyRef ( r, tm) )
35733573 }
35743574
35753575 pub fn mk_mut_ref ( & self , r : & ' tcx Region , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
3576- self . mk_ref ( r, TypeWithMutability { ty : ty, mutbl : ast:: MutMutable } )
3576+ self . mk_ref ( r, TypeAndMut { ty : ty, mutbl : ast:: MutMutable } )
35773577 }
35783578
35793579 pub fn mk_imm_ref ( & self , r : & ' tcx Region , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
3580- self . mk_ref ( r, TypeWithMutability { ty : ty, mutbl : ast:: MutImmutable } )
3580+ self . mk_ref ( r, TypeAndMut { ty : ty, mutbl : ast:: MutImmutable } )
35813581 }
35823582
35833583 pub fn mk_mut_ptr ( & self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
3584- self . mk_ptr ( TypeWithMutability { ty : ty, mutbl : ast:: MutMutable } )
3584+ self . mk_ptr ( TypeAndMut { ty : ty, mutbl : ast:: MutMutable } )
35853585 }
35863586
35873587 pub fn mk_imm_ptr ( & self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
3588- self . mk_ptr ( TypeWithMutability { ty : ty, mutbl : ast:: MutImmutable } )
3588+ self . mk_ptr ( TypeAndMut { ty : ty, mutbl : ast:: MutImmutable } )
35893589 }
35903590
35913591 pub fn mk_nil_ptr ( & self ) -> Ty < ' tcx > {
@@ -4269,7 +4269,7 @@ impl<'tcx> TyS<'tcx> {
42694269 }
42704270
42714271 fn tc_mt < ' tcx > ( cx : & ctxt < ' tcx > ,
4272- mt : TypeWithMutability < ' tcx > ,
4272+ mt : TypeAndMut < ' tcx > ,
42734273 cache : & mut FnvHashMap < Ty < ' tcx > , TypeContents > ) -> TypeContents
42744274 {
42754275 let mc = TC :: ReachesMutable . when ( mt. mutbl == MutMutable ) ;
@@ -4341,11 +4341,11 @@ impl<'tcx> TyS<'tcx> {
43414341 // Fast-path for primitive types
43424342 let result = match self . sty {
43434343 TyBool | TyChar | TyInt ( ..) | TyUint ( ..) | TyFloat ( ..) |
4344- TyRawPtr ( ..) | TyBareFn ( ..) | TyRef ( _, TypeWithMutability {
4344+ TyRawPtr ( ..) | TyBareFn ( ..) | TyRef ( _, TypeAndMut {
43454345 mutbl : ast:: MutImmutable , ..
43464346 } ) => Some ( false ) ,
43474347
4348- TyStr | TyBox ( ..) | TyRef ( _, TypeWithMutability {
4348+ TyStr | TyBox ( ..) | TyRef ( _, TypeAndMut {
43494349 mutbl : ast:: MutMutable , ..
43504350 } ) => Some ( true ) ,
43514351
@@ -4780,10 +4780,10 @@ impl<'tcx> TyS<'tcx> {
47804780 //
47814781 // The parameter `explicit` indicates if this is an *explicit* dereference.
47824782 // Some types---notably unsafe ptrs---can only be dereferenced explicitly.
4783- pub fn builtin_deref ( & self , explicit : bool ) -> Option < TypeWithMutability < ' tcx > > {
4783+ pub fn builtin_deref ( & self , explicit : bool ) -> Option < TypeAndMut < ' tcx > > {
47844784 match self . sty {
47854785 TyBox ( ty) => {
4786- Some ( TypeWithMutability {
4786+ Some ( TypeAndMut {
47874787 ty : ty,
47884788 mutbl : ast:: MutImmutable ,
47894789 } )
@@ -4922,10 +4922,10 @@ impl<'tcx> TyS<'tcx> {
49224922 match autoref {
49234923 None => self ,
49244924 Some ( AutoPtr ( r, m) ) => {
4925- cx. mk_ref ( r, TypeWithMutability { ty : self , mutbl : m } )
4925+ cx. mk_ref ( r, TypeAndMut { ty : self , mutbl : m } )
49264926 }
49274927 Some ( AutoUnsafe ( m) ) => {
4928- cx. mk_ptr ( TypeWithMutability { ty : self , mutbl : m } )
4928+ cx. mk_ptr ( TypeAndMut { ty : self , mutbl : m } )
49294929 }
49304930 }
49314931 }
@@ -5416,7 +5416,7 @@ impl<'tcx> ctxt<'tcx> {
54165416
54175417 pub fn note_and_explain_type_err ( & self , err : & TypeError < ' tcx > , sp : Span ) {
54185418 use self :: TypeError :: * ;
5419-
5419+
54205420 match * err {
54215421 RegionsDoesNotOutlive ( subregion, superregion) => {
54225422 self . note_and_explain_region ( "" , subregion, "..." ) ;
@@ -5984,7 +5984,7 @@ impl<'tcx> ctxt<'tcx> {
59845984 self . lookup_struct_fields ( did) . iter ( ) . map ( |f| {
59855985 Field {
59865986 name : f. name ,
5987- mt : TypeWithMutability {
5987+ mt : TypeAndMut {
59885988 ty : self . lookup_field_type ( did, f. id , substs) ,
59895989 mutbl : MutImmutable
59905990 }
@@ -6070,7 +6070,7 @@ impl<'tcx> ctxt<'tcx> {
60706070 }
60716071 UpvarCapture :: ByRef ( borrow) => {
60726072 tcx. mk_ref ( tcx. mk_region ( borrow. region ) ,
6073- ty:: TypeWithMutability {
6073+ ty:: TypeAndMut {
60746074 ty : freevar_ty,
60756075 mutbl : borrow. kind . to_mutbl_lossy ( ) ,
60766076 } )
@@ -6423,7 +6423,7 @@ impl<'tcx> ctxt<'tcx> {
64236423 h. as_str ( ) . hash ( state) ;
64246424 did. node . hash ( state) ;
64256425 } ;
6426- let mt = |state : & mut SipHasher , mt : TypeWithMutability | {
6426+ let mt = |state : & mut SipHasher , mt : TypeAndMut | {
64276427 mt. mutbl . hash ( state) ;
64286428 } ;
64296429 let fn_sig = |state : & mut SipHasher , sig : & Binder < FnSig < ' tcx > > | {
0 commit comments