@@ -278,6 +278,11 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
278
278
maybe_links : RefCell :: new ( FnvHashMap :: new ( ) ) }
279
279
}
280
280
281
+ pub fn reset_traversal ( & mut self ) {
282
+ self . breadcrumbs . clear ( ) ;
283
+ self . breadcrumbs . shrink_to_fit ( ) ;
284
+ }
285
+
281
286
pub fn traverse_type_if_unseen ( & mut self ,
282
287
typ : ty:: Ty < ' tcx > ,
283
288
keep_going: |& mut Rcx < ' a , ' tcx > | -> bool ) -> bool {
@@ -287,8 +292,18 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
287
292
if !rcx. breadcrumbs. contains( & typ) {
288
293
rcx. breadcrumbs. push( typ) ;
289
294
let keep_going = keep_going( rcx) ;
290
- let top_t = rcx. breadcrumbs. pop( ) ;
291
- assert_eq ! ( top_t, Some ( typ) ) ;
295
+
296
+ // FIXME: popping the breadcrumbs here is a reasonable
297
+ // idea, but then you fall victim to exponential time on
298
+ // examples like src/tests/compile-fail/huge-struct.rs.
299
+ // So pnkfelix is trying to experimentally not remove
300
+ // anything from the vector during any particular
301
+ // traversal, and instead clear it after the whole
302
+ // traversal is done.
303
+ //
304
+ // let top_t = rcx.breadcrumbs.pop();
305
+ // assert_eq!(top_t, Some(typ));
306
+
292
307
keep_going
293
308
} else {
294
309
false
0 commit comments