Open kanpov opened 2 days ago
This probably depends on using the new trait solver in rust-analyzer. We're working on it, but it'll take some time.
This probably depends on using the new trait solver in rust-analyzer. We're working on it, but it'll take some time.
Probably, since this is a decisively complicated type system case, but the interesting part is that RA doesn't error out or crash with its beloved textDocument/completion failed (which I still consistently get at least once a week), just refuses to do completions.
but the interesting part is that RA doesn't error out or crash with its beloved textDocument/completion failed.
The two are unrelated: if you see a visible panic, that's a bug in rust-analyzer. If you get a reproduction/backtrace and report it, we'd appreciate tremendously. What you're seeing in this issue is rust-analyzer correctly timing out and giving up on solving this trait bound.
SUMMARY OF THE ISSUE: This is an example from my code, this trait definition will provide code completions via RA just fine:
As you can see, it has a concrete requirement on the IntoFuture associated type of IntoFuture.
However, if, instead of making the associated type requirement a concrete type, I simply set a
: Send
bound (or any other trait bound) on it like so, everything still compiles through cargo and rustc, yet RA is unable to show the same completions even after saving and cargo check-ing:Granted, this can be considered type system torture, but the language supports it just fine, so RA should as well.
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P) rust-analyzer version: 0.3.2137-standalone [/home/kanpov/.vscode/extensions/rust-lang.rust-analyzer-0.3.2137-linux-x64/server/rust-analyzer]
rustc version: (eg. output of
rustc -V
) rustc 1.81.0 (eeb90cda1 2024-09-04)editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable) VSCode
relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTC
,RUSTUP_HOME
orCARGO_HOME
)repository link (if public, optional): (eg. rust-analyzer)
code snippet to reproduce: Snippets were provided above