@@ -93,12 +93,6 @@ struct LookupTable {
93
93
data : FxHashMap < Type , AlternativeExprs > ,
94
94
/// New types reached since last query by the `NewTypesKey`
95
95
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 > ,
102
96
/// Types queried but not present
103
97
types_wishlist : FxHashSet < Type > ,
104
98
/// Threshold to squash trees to `Many`
@@ -212,37 +206,6 @@ impl LookupTable {
212
206
}
213
207
}
214
208
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
-
246
209
/// Types queried but not found
247
210
fn types_wishlist ( & mut self ) -> & FxHashSet < Type > {
248
211
& self . types_wishlist
@@ -328,19 +291,12 @@ pub fn term_search<DB: HirDatabase>(ctx: &TermSearchCtx<'_, DB>) -> Vec<Expr> {
328
291
solutions. extend ( tactics:: assoc_const ( ctx, & defs, & mut lookup) ) ;
329
292
330
293
while should_continue ( ) {
331
- lookup. new_round ( ) ;
332
-
333
294
solutions. extend ( tactics:: data_constructor ( ctx, & defs, & mut lookup, should_continue) ) ;
334
295
solutions. extend ( tactics:: free_function ( ctx, & defs, & mut lookup, should_continue) ) ;
335
296
solutions. extend ( tactics:: impl_method ( ctx, & defs, & mut lookup, should_continue) ) ;
336
297
solutions. extend ( tactics:: struct_projection ( ctx, & defs, & mut lookup, should_continue) ) ;
337
298
solutions. extend ( tactics:: impl_static_method ( ctx, & defs, & mut lookup, should_continue) ) ;
338
299
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
- }
344
300
}
345
301
346
302
solutions. into_iter ( ) . filter ( |it| !it. is_many ( ) ) . unique ( ) . collect ( )
0 commit comments