rust-analyzer: Small change in rustup rust-src component breaks rust-analyzer
After upgrading rust to 1.47.0 via rustup I get the following error from rust-analyzer:
rust-analyzer failed to load workspace: Failed to find sysroot for Cargo.toml file /home/ddboline/setup_files/build/garmin_rust/Cargo.toml. Is rust-src installed?: could not find libcore in sysroot path `/home/ddboline/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/`
This appears to be the result of ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src being renamed to ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library, creating a symlink from library to src serves as a workaround.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 18 (12 by maintainers)
https://github.com/rust-analyzer/rust-analyzer/pull/6185 adds an extra note to the error when
RUST_SRC_PATHis setThat path has recently changed, as @ddboline has noticed. You should unset the variable or fix it.
But also, while we recommend not using RUST_SRC_PATH, I think there are setups where it’s needed (otherwise we should just remove the support). So I don’t think we can just show a warning on every startup.
Maybe we could try
$RUST_SRC_PATH/../libraryif$RUST_SRC_PATHdoesn’t work 🤔@lnicola Yep, that was the problem, a forgotten RUST_SRC_PATH entry in ~/.bash_profile, I’m gonna go ahead and close this issue.