rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Rust-analyzer keeps spamming log area and auto-complete is very slow

Open KunoiSayami opened this issue 2 months ago • 8 comments

rust-analyzer version: rust-analyzer version: 0.3.2658-standalone (049767e6fa 2025-10-26)

rustc version: rustc 1.90.0 (1159e78c4 2025-09-14)

editor or extension: VSCode: Version: 1.105.1 (system setup)

relevant settings: N/A

repository link (if public, optional): N/A

code snippet to reproduce:

const TEST: &str = "TEST";

fn main() {
    let s = "rust".to_string();
    match s.as_str() {
        TEST => {}
        _ => {}
    }
}

When use code, every input will cause some output like, even when focus change:

2025-10-28T17:04:58.3691467+08:00 ERROR Overloaded deref on type str is not a projection
2025-10-28T17:05:05.7191977+08:00 ERROR pattern has unexpected type: pat: Pat { ty: str, kind: Deref { subpattern: Pat { ty: &'{region error} str, kind: Deref { subpattern: Pat { ty: &'{region error} str, kind: Wild } } } } }, ty: str

KunoiSayami avatar Oct 28 '25 09:10 KunoiSayami

Might be related to #20149

ShoyuVanilla avatar Oct 29 '25 04:10 ShoyuVanilla

Seems same issue, if I explicitly specifying the lifecycle it won't show errors.

KunoiSayami avatar Oct 29 '25 05:10 KunoiSayami

Looks like I have to rewrite our type inference code for patterns. Our current code is quite wrong, especially with pattern adjustments for reborrows. I once reached to the same conclusion on #20149 but forgot about it a while 😅 This is the time I have to do it

ShoyuVanilla avatar Oct 31 '25 03:10 ShoyuVanilla

@ShoyuVanilla I'm currently in the process of rewriting our method resolution to match rustc (final stages of fixing the last bugs). Granted, it almost doesn't touch pattern inference, but I still would prefer to not do it yet, although if you really want...

ChayimFriedman2 avatar Oct 31 '25 07:10 ChayimFriedman2

Okay, I'll wait until then

ShoyuVanilla avatar Oct 31 '25 07:10 ShoyuVanilla

Autocompletion is fast for me (maybe that was fixed), but the logs keep being emitted, that needs the fix @ShoyuVanilla described.

ChayimFriedman2 avatar Nov 28 '25 04:11 ChayimFriedman2

Yeah, I'm gonna do it in next coming days. I'm just asking to confirm, will it overlap with your attribute handling rewrite, Chayim? I guess not because they are quite distant things but I'm not totally sure as I haven't looked into your PR much 😅

ShoyuVanilla avatar Nov 28 '25 04:11 ShoyuVanilla

Attribute rewrite barely touches hir-ty, and if something change I can rebase easily (rebasing over hir-def is a pain though). So I don't think this will conflict.

ChayimFriedman2 avatar Nov 28 '25 04:11 ChayimFriedman2