Hello,
I am new to Rust and having some trouble with the Rust Analyzer extension for VSCode on MacOS. The error I am getting with Rust Analyzer is:
rust-analyzer failed to load workspace: Failed to find sysroot for Cargo.toml file /Users/apple/rustApps/guessing_game/Cargo.toml. Is rust-src installed?: can't load standard library from sysroot /Users/apple/.rustup/toolchains/stable-x86_64-apple-darwin (discovered via rustc --print sysroot
) try installing the Rust source the same way you installed rustc
In my efforts to root cause this issue I used the command: 'rustup show' and received the following results:
Default host: x86_64-apple-darwin
rustup home: /Users/apple/.rustup
stable-x86_64-apple-darwin (default)
rustc 1.65.0 (897e37553 2022-11-02)
According to ChatGPT the rust-src component should have been listed with the results. When I discovered I could not find the rust-src component in the results from 'rustup show', I went ahead and tried to install rust-src with 'rustup component add rust-src', this is the info and error i received:
info: downloading component 'rust-src'
info: retrying download for 'https://static.rust-lang.org/dist/2022-11-03/rust-src-1.65.0.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2022-11-03/rust-src-1.65.0.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2022-11-03/rust-src-1.65.0.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2022-11-03/rust-src-1.65.0.tar.xz'
error: component download failed for rust-src: could not download file from 'https://static.rust-lang.org/dist/2022-11-03/rust-src-1.65.0.tar.xz' to '/Users/apple/.rustup/downloads/7dfdbecad68d9fbc64574eb403aa4815adef563dd6fb1d8a1be3b9fff364deb2.partial'
What do you believe should be my next steps to resolve the issue(s) I am having with Rust Analyzer and rust-src?