11use crate :: infer:: outlives:: env:: RegionBoundPairs ;
22use crate :: infer:: region_constraints:: VerifyIfEq ;
33use crate :: infer:: { GenericKind , VerifyBound } ;
4- use rustc_data_structures:: sso:: SsoHashSet ;
5- use rustc_middle:: ty:: GenericArg ;
64use rustc_middle:: ty:: { self , OutlivesPredicate , Ty , TyCtxt } ;
75use rustc_type_ir:: outlives:: { compute_alias_components_recursive, Component } ;
86
@@ -99,12 +97,8 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
9997 self . declared_generic_bounds_from_env_for_erased_ty ( erased_alias_ty)
10098 }
10199
102- #[ instrument( level = "debug" , skip( self , visited) ) ]
103- pub fn alias_bound (
104- & self ,
105- alias_ty : ty:: AliasTy < ' tcx > ,
106- visited : & mut SsoHashSet < GenericArg < ' tcx > > ,
107- ) -> VerifyBound < ' tcx > {
100+ #[ instrument( level = "debug" , skip( self ) ) ]
101+ pub fn alias_bound ( & self , alias_ty : ty:: AliasTy < ' tcx > ) -> VerifyBound < ' tcx > {
108102 let alias_ty_as_ty = alias_ty. to_ty ( self . tcx ) ;
109103
110104 // Search the env for where clauses like `P: 'a`.
@@ -130,21 +124,22 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
130124 // see the extensive comment in projection_must_outlive
131125 let recursive_bound = {
132126 let mut components = smallvec ! [ ] ;
133- compute_alias_components_recursive ( self . tcx , alias_ty_as_ty, & mut components, visited) ;
134- self . bound_from_components ( & components, visited)
127+ compute_alias_components_recursive (
128+ self . tcx ,
129+ alias_ty_as_ty,
130+ & mut components,
131+ & mut Default :: default ( ) ,
132+ ) ;
133+ self . bound_from_components ( & components)
135134 } ;
136135
137136 VerifyBound :: AnyBound ( env_bounds. chain ( definition_bounds) . collect ( ) ) . or ( recursive_bound)
138137 }
139138
140- fn bound_from_components (
141- & self ,
142- components : & [ Component < TyCtxt < ' tcx > > ] ,
143- visited : & mut SsoHashSet < GenericArg < ' tcx > > ,
144- ) -> VerifyBound < ' tcx > {
139+ fn bound_from_components ( & self , components : & [ Component < TyCtxt < ' tcx > > ] ) -> VerifyBound < ' tcx > {
145140 let mut bounds = components
146141 . iter ( )
147- . map ( |component| self . bound_from_single_component ( component, visited ) )
142+ . map ( |component| self . bound_from_single_component ( component) )
148143 // Remove bounds that must hold, since they are not interesting.
149144 . filter ( |bound| !bound. must_hold ( ) ) ;
150145
@@ -159,18 +154,15 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
159154 fn bound_from_single_component (
160155 & self ,
161156 component : & Component < TyCtxt < ' tcx > > ,
162- visited : & mut SsoHashSet < GenericArg < ' tcx > > ,
163157 ) -> VerifyBound < ' tcx > {
164158 match * component {
165159 Component :: Region ( lt) => VerifyBound :: OutlivedBy ( lt) ,
166160 Component :: Param ( param_ty) => self . param_or_placeholder_bound ( param_ty. to_ty ( self . tcx ) ) ,
167161 Component :: Placeholder ( placeholder_ty) => {
168162 self . param_or_placeholder_bound ( Ty :: new_placeholder ( self . tcx , placeholder_ty) )
169163 }
170- Component :: Alias ( alias_ty) => self . alias_bound ( alias_ty, visited) ,
171- Component :: EscapingAlias ( ref components) => {
172- self . bound_from_components ( components, visited)
173- }
164+ Component :: Alias ( alias_ty) => self . alias_bound ( alias_ty) ,
165+ Component :: EscapingAlias ( ref components) => self . bound_from_components ( components) ,
174166 Component :: UnresolvedInferenceVariable ( v) => {
175167 // Ignore this, we presume it will yield an error later, since
176168 // if a type variable is not resolved by this point it never
0 commit comments