@@ -221,6 +221,7 @@ fn extract_component_raw<'tcx>(
221
221
tcx : TyCtxt < ' tcx > ,
222
222
param_env : ty:: ParamEnv < ' tcx > ,
223
223
ty : Ty < ' tcx > ,
224
+ ty_seen : & mut UnordSet < Ty < ' tcx > > ,
224
225
) -> SmallVec < [ Ty < ' tcx > ; 4 ] > {
225
226
// Droppiness does not depend on regions, so let us erase them.
226
227
let ty = tcx. try_normalize_erasing_regions ( param_env, ty) . unwrap_or ( ty) ;
@@ -232,10 +233,14 @@ fn extract_component_raw<'tcx>(
232
233
if let Some ( tys) = true_significant_drop_ty ( tcx, ty) {
233
234
// Some types can be further opened up because the drop is simply delegated
234
235
for ty in tys {
235
- out_tys. extend ( extract_component_raw ( tcx, param_env, ty) ) ;
236
+ if ty_seen. insert ( ty) {
237
+ out_tys. extend ( extract_component_raw ( tcx, param_env, ty, ty_seen) ) ;
238
+ }
236
239
}
237
240
} else {
238
- out_tys. push ( ty) ;
241
+ if ty_seen. insert ( ty) {
242
+ out_tys. push ( ty) ;
243
+ }
239
244
}
240
245
}
241
246
out_tys
@@ -247,7 +252,7 @@ fn extract_component_with_significant_dtor<'tcx>(
247
252
param_env : ty:: ParamEnv < ' tcx > ,
248
253
ty : Ty < ' tcx > ,
249
254
) -> SmallVec < [ Ty < ' tcx > ; 4 ] > {
250
- let mut tys = extract_component_raw ( tcx, param_env, ty) ;
255
+ let mut tys = extract_component_raw ( tcx, param_env, ty, & mut Default :: default ( ) ) ;
251
256
let mut deduplicate = FxHashSet :: default ( ) ;
252
257
tys. retain ( |oty| deduplicate. insert ( * oty) ) ;
253
258
tys. into_iter ( ) . collect ( )
0 commit comments