@@ -96,26 +96,17 @@ pub fn trait_ref_is_local_or_fundamental<I: Interner>(tcx: I, trait_ref: ty::Tra
9696 trait_ref. def_id . is_local ( ) || tcx. trait_is_fundamental ( trait_ref. def_id )
9797}
9898
99- TrivialTypeTraversalImpls ! { IsFirstInputType , }
99+ TrivialTypeTraversalImpls ! { InSelfTy }
100100
101101#[ derive( Debug , Copy , Clone ) ]
102- pub enum IsFirstInputType {
102+ pub enum InSelfTy {
103103 No ,
104104 Yes ,
105105}
106106
107- impl From < bool > for IsFirstInputType {
108- fn from ( b : bool ) -> IsFirstInputType {
109- match b {
110- false => IsFirstInputType :: No ,
111- true => IsFirstInputType :: Yes ,
112- }
113- }
114- }
115-
116107#[ derive_where( Debug ; I : Interner , T : Debug ) ]
117108pub enum OrphanCheckErr < I : Interner , T > {
118- NonLocalInputType ( Vec < ( I :: Ty , IsFirstInputType ) > ) ,
109+ NonLocalInputType ( Vec < ( I :: Ty , InSelfTy ) > ) ,
119110 UncoveredTyParams ( UncoveredTyParams < I , T > ) ,
120111}
121112
@@ -258,11 +249,11 @@ where
258249struct OrphanChecker < ' a , Infcx , I : Interner , F > {
259250 infcx : & ' a Infcx ,
260251 in_crate : InCrate ,
261- in_self_ty : bool ,
252+ in_self_ty : InSelfTy ,
262253 lazily_normalize_ty : F ,
263254 /// Ignore orphan check failures and exclusively search for the first local type.
264255 search_first_local_ty : bool ,
265- non_local_tys : Vec < ( I :: Ty , IsFirstInputType ) > ,
256+ non_local_tys : Vec < ( I :: Ty , InSelfTy ) > ,
266257}
267258
268259impl < ' a , Infcx , I , F , E > OrphanChecker < ' a , Infcx , I , F >
@@ -275,15 +266,15 @@ where
275266 OrphanChecker {
276267 infcx,
277268 in_crate,
278- in_self_ty : true ,
269+ in_self_ty : InSelfTy :: Yes ,
279270 lazily_normalize_ty,
280271 search_first_local_ty : false ,
281272 non_local_tys : Vec :: new ( ) ,
282273 }
283274 }
284275
285276 fn found_non_local_ty ( & mut self , t : I :: Ty ) -> ControlFlow < OrphanCheckEarlyExit < I , E > > {
286- self . non_local_tys . push ( ( t, self . in_self_ty . into ( ) ) ) ;
277+ self . non_local_tys . push ( ( t, self . in_self_ty ) ) ;
287278 ControlFlow :: Continue ( ( ) )
288279 }
289280
@@ -449,7 +440,7 @@ where
449440 } ;
450441 // A bit of a hack, the `OrphanChecker` is only used to visit a `TraitRef`, so
451442 // the first type we visit is always the self type.
452- self . in_self_ty = false ;
443+ self . in_self_ty = InSelfTy :: No ;
453444 result
454445 }
455446
0 commit comments