> found out that VS Code was running cargo check one way while in the terminal cargo check was doing some other thing, and effectively blowing the cache every time I switched from one to the other
I have a similar problem with JetBrains RustRover. For example when I do cargo build and cargo clippy in the terminal after RustRover has done build it seems to start over rebuilding more things than when I edit something in vim and only use cargo from the terminal.
Yeah I found the same thing. The issue turned out to be that something in my `.bashrc` was appending to `PATH` (or some other env var). Because my `cargo build` commands that were running in one more level of shell than Rust-analyzer, it had different env vars and therefore a different cache key.
Once you fix it so that Rust-analyzer sees the same env vars as your shell then the issue goes away. It's kind of annoyingly hard to debug though.