rust-analyzer/crates
bors 6b250a22c4 Auto merge of #16687 - kilpkonn:master, r=Veykril
feat: Add "make tuple" tactic to term search

Follow up to https://github.com/rust-lang/rust-analyzer/pull/16092

Now term search also supports tuples.
```rust
let a: i32 = 1;
let b: f64 = 0.0;
let c: (i32, (f64, i32)) = todo!(); // Finds (a, (b, a))
```
In addition to new tactic that handles tuples I changed how the generics are handled.
Previously it tried all possible options from types we had in scope but now it only tries useful ones that help us directly towards the goal or at least towards calling some other function.
This changes O(2^n) to O(n^2) where n is amount of rounds which in practice allows using types that take generics for multiple rounds (previously limited to 1). Average case that also used to be exponential is now roughly linear.
This means that deeply nested generics also work.
````rust
// Finds all valid combos, including `Some(Some(Some(...)))`
let a: Option<Option<Option<bool>>> = todo!();
````

_Note that although the complexity is smaller allowing more types with generics the search overall slows down considerably. I hope it's fine tho as the autocomplete is disabled by default and for code actions it's not super slow. Might have to tweak the depth hyper parameter tho_

This resulted in a huge increase of results found (benchmarks on `ripgrep` crate):
Before
````
Tail Expr syntactic hits: 149/1692 (8%)
Tail Exprs found: 749/1692 (44%)
Term search avg time: 18ms
```
After
```
Tail Expr syntactic hits: 291/1692 (17%)
Tail Exprs found: 1253/1692 (74%)
Term search avg time: 139ms
````

Most changes are local to term search except some tuple related stuff on `hir::Type`.
2024-02-27 09:41:14 +00:00
..
base-db fix: Fix modules in blocks not resolving in ide layer 2024-02-26 14:54:47 +01:00
cfg Merge commit '7219414e81' into sync-from-ra 2024-01-28 15:56:54 +02:00
flycheck Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
hir Auto merge of #16687 - kilpkonn:master, r=Veykril 2024-02-27 09:41:14 +00:00
hir-def fix: Fix modules in blocks not resolving in ide layer 2024-02-26 14:54:47 +01:00
hir-expand Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
hir-ty internal: Remove dead branches in method_resolutiopn::is_valid_candidate 2024-02-27 10:00:45 +01:00
ide fix: Fix modules in blocks not resolving in ide layer 2024-02-26 14:54:47 +01:00
ide-assists Auto merge of #16687 - kilpkonn:master, r=Veykril 2024-02-27 09:41:14 +00:00
ide-completion Auto merge of #16687 - kilpkonn:master, r=Veykril 2024-02-27 09:41:14 +00:00
ide-db Auto merge of #16555 - davidbarsky:david/speedup-completions-by-exploiting-orphan-rules, r=Veykril 2024-02-26 18:05:52 +00:00
ide-diagnostics Auto merge of #16684 - Veykril:synthetic-fmt-args, r=Veykril 2024-02-26 16:47:57 +00:00
ide-ssr Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
intern Merge commit '426d2842c1' into sync-from-ra2 2024-01-03 11:35:07 +02:00
limit Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
load-cargo internal: Fetch toolchain and datalayout for DetachedFiles 2024-02-20 10:40:39 +01:00
mbe Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
parser Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
paths Merge commit '426d2842c1' into sync-from-ra2 2024-01-03 11:35:07 +02:00
proc-macro-api Fix rust-analyzer not enabling rust-analyzer spans on the proc-macro server 2024-02-22 22:34:03 +01:00
proc-macro-srv fix: Fix proc-macro server not accounting for string delimiters correctly 2024-02-22 22:34:03 +01:00
proc-macro-srv-cli Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
profile Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
project-model Don't build dependencies when retrieving target data layout 2024-02-20 19:16:55 -08:00
rust-analyzer Filter out false positive errors 2024-02-26 20:17:09 +02:00
salsa Remove salsa compile_fail tests 2024-02-26 15:26:55 +02:00
sourcegen Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
span Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
stdx Deduplicate references to macro argument 2024-02-19 12:23:59 +01:00
syntax Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
test-fixture Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
test-utils Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
text-edit Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
toolchain prioritise rustup sysroots over system ones 2024-02-24 21:19:10 +00:00
tt Merge commit 'ac998a74b3' into sync-from-ra 2024-02-18 09:41:20 +02:00
vfs Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
vfs-notify Merge commit 'a911652360' into sync-from-ra 2024-01-21 16:53:06 +02:00