Our rust-toolchain.toml
has specified the 1.80.0 toolchain for a long time now and everything has been working fine with rust-analyzer and VSCode. We get code completion, tooltip help, etc. Today, however, none of that was working for anything in std
. Types defined by std
(and wrapped by std
example Option<T>
) just show "{unknown}" for type info and no completion. I tried deleting target/
and rebuilding a couple times to no avail.
My first thought was to check that the rust-src or rust-std were installed for 1.80.0. They were. I even tried removing and re-adding them. I even tried https://github.com/rust-lang/rust-analyzer/issues/17759#issuecomment-2270679715:
cd $(rustc --print sysroot)/lib/rustlib/src/rust/library && __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS=nightly cargo metadata
This worked fine for stable (1.85 as of this post) but for 1.80 said that Cargo.toml
wasn't found.
I had used cache clean
last week - though things seemed to work still after that - and accidentally installed rust
via homebrew to compile a formula, so I uninstalled that and deleted both ~/.rustup and ~/.cargo, re-installed rust, installed my toolchains again and...
Same thing! No Cargo.toml found for 1.80, and rust-analyzer not showing info for std. It does for types, members in our workspace as well as third-party crates like tokio
. I updated our rust-toolchian.toml
file to the "stable" channel and rust-analyzer works just fine again.
What happened, or better, how do I fix it? I mean, we could consider upgrading our baseline channel - 1.80 is pretty old, but we're trying to target as low as we can go and that's what we can do for now - but how my machine even get in this state I wonder? I ran rustup update
right after 1.85 came out but it's been a (Short) while and everything was working. It's almost as if my rust-src
or something got obliterated, but after deleting - full rm -rf ~/.rustup
(and .cargo
) - rust and re-installing the toolchains and components, how is it still not working?