@@ -93,12 +93,6 @@ struct LookupTable {
9393 data : FxHashMap < Type , AlternativeExprs > ,
9494 /// New types reached since last query by the `NewTypesKey`
9595 new_types : FxHashMap < NewTypesKey , Vec < Type > > ,
96- /// ScopeDefs that are not interesting any more
97- exhausted_scopedefs : FxHashSet < ScopeDef > ,
98- /// ScopeDefs that were used in current round
99- round_scopedef_hits : FxHashSet < ScopeDef > ,
100- /// Amount of rounds since scopedef was first used.
101- rounds_since_sopedef_hit : FxHashMap < ScopeDef , u32 > ,
10296 /// Types queried but not present
10397 types_wishlist : FxHashSet < Type > ,
10498 /// Threshold to squash trees to `Many`
@@ -212,37 +206,6 @@ impl LookupTable {
212206 }
213207 }
214208
215- /// Mark `ScopeDef` as exhausted meaning it is not interesting for us any more
216- fn mark_exhausted ( & mut self , def : ScopeDef ) {
217- self . exhausted_scopedefs . insert ( def) ;
218- }
219-
220- /// Mark `ScopeDef` as used meaning we managed to produce something useful from it
221- fn mark_fulfilled ( & mut self , def : ScopeDef ) {
222- self . round_scopedef_hits . insert ( def) ;
223- }
224-
225- /// Start new round (meant to be called at the beginning of iteration in `term_search`)
226- ///
227- /// This functions marks some `ScopeDef`s as exhausted if there have been
228- /// `MAX_ROUNDS_AFTER_HIT` rounds after first using a `ScopeDef`.
229- fn new_round ( & mut self ) {
230- for def in & self . round_scopedef_hits {
231- let hits =
232- self . rounds_since_sopedef_hit . entry ( * def) . and_modify ( |n| * n += 1 ) . or_insert ( 0 ) ;
233- const MAX_ROUNDS_AFTER_HIT : u32 = 2 ;
234- if * hits > MAX_ROUNDS_AFTER_HIT {
235- self . exhausted_scopedefs . insert ( * def) ;
236- }
237- }
238- self . round_scopedef_hits . clear ( ) ;
239- }
240-
241- /// Get exhausted `ScopeDef`s
242- fn exhausted_scopedefs ( & self ) -> & FxHashSet < ScopeDef > {
243- & self . exhausted_scopedefs
244- }
245-
246209 /// Types queried but not found
247210 fn types_wishlist ( & mut self ) -> & FxHashSet < Type > {
248211 & self . types_wishlist
@@ -328,19 +291,12 @@ pub fn term_search<DB: HirDatabase>(ctx: &TermSearchCtx<'_, DB>) -> Vec<Expr> {
328291 solutions. extend ( tactics:: assoc_const ( ctx, & defs, & mut lookup) ) ;
329292
330293 while should_continue ( ) {
331- lookup. new_round ( ) ;
332-
333294 solutions. extend ( tactics:: data_constructor ( ctx, & defs, & mut lookup, should_continue) ) ;
334295 solutions. extend ( tactics:: free_function ( ctx, & defs, & mut lookup, should_continue) ) ;
335296 solutions. extend ( tactics:: impl_method ( ctx, & defs, & mut lookup, should_continue) ) ;
336297 solutions. extend ( tactics:: struct_projection ( ctx, & defs, & mut lookup, should_continue) ) ;
337298 solutions. extend ( tactics:: impl_static_method ( ctx, & defs, & mut lookup, should_continue) ) ;
338299 solutions. extend ( tactics:: make_tuple ( ctx, & defs, & mut lookup, should_continue) ) ;
339-
340- // Discard not interesting `ScopeDef`s for speedup
341- for def in lookup. exhausted_scopedefs ( ) {
342- defs. remove ( def) ;
343- }
344300 }
345301
346302 solutions. into_iter ( ) . filter ( |it| !it. is_many ( ) ) . unique ( ) . collect ( )
0 commit comments