rust-analyzer/crates
bors 9db1258dbe Auto merge of #17203 - kilpkonn:collapse_terms, r=Veykril
Fix OOM caused by term search

The issue came from multi Cartesian product for exprs with many (25+) arguments, each having multiple options.
The solution is two fold:
### Avoid blowing up in Cartesian product
**Before the logic was:**
    1. Find expressions for each argument/param - there may be many
    2. Take the Cartesian product (which blows up in some cases)
    4. If there are more than 2 options throw them away by squashing them to `Many`
**Now the logic is:**
    1. Find expressions for each argument/param and squash them to `Many` if there are more than 2 as otherwise we are guaranteed to also have more than 2 after taking the product which means squashing them anyway.
    2. Take the Cartesian product on iterator
    3. Start consuming it one by one
    4. If there are more than 2 options throw them away by squashing them to `Many`  (same as before)

This is also why I had to update some tests as the expressions get squashed to many more eagerly.

### Use fuel to avoid long search times and high memory usage
Now all the tactics use `should_continue:  Fn() -> bool` to chech if they should keep iterating _(Similarly to chalk)_.
This reduces the search times by a magnitude, for example from ~139ms/hole to ~14ms/hole for `ripgrep` crate.
There are slightly less expressions found, but I think speed gain worth it for usability.
Also note that syntactic hits decreases more because of squashing so you simple need to run search multiple times to get full terms.
Also the worst case time (For example `nalgebra` crate cus it has tons of generics) has search times mostly under 200ms.

Benchmarks on `ripgrep` crate
Before:
```
Tail Expr syntactic hits: 291/1692 (17%)
Tail Exprs found: 1253/1692 (74%)
Term search avg time: 139ms
````
After:
```
Tail Expr syntactic hits: 239/1692 (14%)
Tail Exprs found: 1226/1692 (72%)
Term search avg time: 14ms
```
2024-05-13 10:30:12 +00:00
..
base-db fix: Correctly handle no_core/no_std for preludes 2024-05-02 10:50:28 +02:00
cfg fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
flycheck Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
hir Make term search fuel configurable 2024-05-08 19:46:33 +03:00
hir-def Auto merge of #17175 - Veykril:fix-implicit-ty-args, r=Veykril 2024-05-02 10:04:13 +00:00
hir-expand Implement unsafe attribute parsing 2024-05-06 12:11:29 +02:00
hir-ty fix lifetime bound var index in dyn trait 2024-05-05 23:40:34 +05:30
ide Implement unsafe attribute parsing 2024-05-06 12:11:29 +02:00
ide-assists Auto merge of #17203 - kilpkonn:collapse_terms, r=Veykril 2024-05-13 10:30:12 +00:00
ide-completion Auto merge of #17203 - kilpkonn:collapse_terms, r=Veykril 2024-05-13 10:30:12 +00:00
ide-db fix: Tracing span names should match function names 2024-04-30 11:22:47 -07:00
ide-diagnostics Make term search fuel configurable 2024-05-08 19:46:33 +03:00
ide-ssr internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros 2024-04-14 16:02:38 +02:00
intern Fix new clippy lints 2024-04-01 17:55:56 +02:00
limit Simplify 2024-04-06 13:12:07 +02:00
load-cargo fix: Tracing span names should match function names 2024-04-30 11:22:47 -07:00
mbe fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
parser Implement unsafe attribute parsing 2024-05-06 12:11:29 +02:00
paths fix: Don't assert paths being utf8 when filtering them in the watcher 2024-03-22 08:04:50 +01:00
proc-macro-api fix: Tracing span names should match function names 2024-04-30 11:22:47 -07:00
proc-macro-srv Auto merge of #16257 - lnicola:rustc-check-cfg, r=Veykril 2024-04-18 12:13:06 +00:00
proc-macro-srv-cli Auto merge of #16257 - lnicola:rustc-check-cfg, r=Veykril 2024-04-18 12:13:06 +00:00
profile Update rust-analyzer to use windows-sys crate 2024-05-01 09:04:13 -05:00
project-model fix: Correctly handle no_core/no_std for preludes 2024-05-02 10:50:28 +02:00
rust-analyzer Auto merge of #17203 - kilpkonn:collapse_terms, r=Veykril 2024-05-13 10:30:12 +00:00
salsa fix: Fix expression scopes not being calculated for inline consts 2024-04-25 09:49:19 +02:00
sourcegen Fix new clippy lints 2024-04-01 17:55:56 +02:00
span Cleanup 2024-04-18 11:00:22 +02:00
stdx Update rust-analyzer to use windows-sys crate 2024-05-01 09:04:13 -05:00
syntax Implement unsafe attribute parsing 2024-05-06 12:11:29 +02:00
test-fixture fix: Correctly handle no_core/no_std for preludes 2024-05-02 10:50:28 +02:00
test-utils Peek for panic message in test output 2024-04-21 08:50:25 +02:00
text-edit Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
toolchain internal: Enforce utf8 paths 2024-03-19 15:39:00 +01:00
tt internal: Remove span trait 2024-03-21 20:08:30 +01:00
vfs chore: add some tracing to project loading 2024-04-22 11:39:01 -04:00
vfs-notify discard when the path is invalid utf8 symbol. 2024-04-30 15:39:05 +08:00