1
1
use crate :: infer:: outlives:: env:: RegionBoundPairs ;
2
2
use crate :: infer:: region_constraints:: VerifyIfEq ;
3
3
use crate :: infer:: { GenericKind , VerifyBound } ;
4
- use rustc_data_structures:: sso:: SsoHashSet ;
5
- use rustc_middle:: ty:: GenericArg ;
6
4
use rustc_middle:: ty:: { self , OutlivesPredicate , Ty , TyCtxt } ;
7
5
use rustc_type_ir:: outlives:: { compute_alias_components_recursive, Component } ;
8
6
@@ -99,12 +97,8 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
99
97
self . declared_generic_bounds_from_env_for_erased_ty ( erased_alias_ty)
100
98
}
101
99
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 > {
108
102
let alias_ty_as_ty = alias_ty. to_ty ( self . tcx ) ;
109
103
110
104
// Search the env for where clauses like `P: 'a`.
@@ -130,21 +124,22 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
130
124
// see the extensive comment in projection_must_outlive
131
125
let recursive_bound = {
132
126
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)
135
134
} ;
136
135
137
136
VerifyBound :: AnyBound ( env_bounds. chain ( definition_bounds) . collect ( ) ) . or ( recursive_bound)
138
137
}
139
138
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 > {
145
140
let mut bounds = components
146
141
. iter ( )
147
- . map ( |component| self . bound_from_single_component ( component, visited ) )
142
+ . map ( |component| self . bound_from_single_component ( component) )
148
143
// Remove bounds that must hold, since they are not interesting.
149
144
. filter ( |bound| !bound. must_hold ( ) ) ;
150
145
@@ -159,18 +154,15 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
159
154
fn bound_from_single_component (
160
155
& self ,
161
156
component : & Component < TyCtxt < ' tcx > > ,
162
- visited : & mut SsoHashSet < GenericArg < ' tcx > > ,
163
157
) -> VerifyBound < ' tcx > {
164
158
match * component {
165
159
Component :: Region ( lt) => VerifyBound :: OutlivedBy ( lt) ,
166
160
Component :: Param ( param_ty) => self . param_or_placeholder_bound ( param_ty. to_ty ( self . tcx ) ) ,
167
161
Component :: Placeholder ( placeholder_ty) => {
168
162
self . param_or_placeholder_bound ( Ty :: new_placeholder ( self . tcx , placeholder_ty) )
169
163
}
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) ,
174
166
Component :: UnresolvedInferenceVariable ( v) => {
175
167
// Ignore this, we presume it will yield an error later, since
176
168
// if a type variable is not resolved by this point it never
0 commit comments