Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust-analyzer can't find Rust source on nightly-2020-07-29 #5577

Closed
ivan opened this issue Jul 29, 2020 · 5 comments · Fixed by #5586
Closed

rust-analyzer can't find Rust source on nightly-2020-07-29 #5577

ivan opened this issue Jul 29, 2020 · 5 comments · Fixed by #5586
Assignees

Comments

@ivan
Copy link
Contributor

ivan commented Jul 29, 2020

I see

rust-analyzer failed to load workspace: Failed to find sysroot for Cargo.toml file [...]/Cargo.toml. Is rust-src installed?: can't load standard library from sysroot /home/at/.rustup/toolchains/nightly-2020-07-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src (discovered via `rustc --print sysroot`) try running `rustup component add rust-src` or set `RUST_SRC_PATH`

with the rust-src component installed on nightly-2020-07-29.

rust-analyzer expects let src_path = sysroot_path.join("lib/rustlib/src/rust/src"); but nightly-2020-07-29 seems to have changed the paths:

/home/at/.rustup/toolchains/nightly-2020-07-28-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/:
total 118,784
-rw-r----- 1 at at 115,526 2020-07-29 21:25 Cargo.lock
drwxr-x--- 1 at at     260 2020-07-29 21:25 src/

/home/at/.rustup/toolchains/nightly-2020-07-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/:
total 118,784
-rw-r----- 1 at at 115,526 2020-07-29 21:17 Cargo.lock
drwxr-x--- 1 at at     328 2020-07-29 21:17 library/
# ls -l /home/at/.rustup/toolchains/nightly-2020-07-28-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src
total 0
drwxr-x--- 1 at at  32 2020-07-29 21:25 build_helper/
drwxr-x--- 1 at at 340 2020-07-29 21:25 liballoc/
drwxr-x--- 1 at at 638 2020-07-29 21:25 libcore/
drwxr-x--- 1 at at  32 2020-07-29 21:25 libpanic_abort/
drwxr-x--- 1 at at 128 2020-07-29 21:25 libpanic_unwind/
drwxr-x--- 1 at at  96 2020-07-29 21:25 libproc_macro/
drwxr-x--- 1 at at  48 2020-07-29 21:25 libprofiler_builtins/
drwxr-x--- 1 at at 534 2020-07-29 21:25 libstd/
drwxr-x--- 1 at at  60 2020-07-29 21:25 libterm/
drwxr-x--- 1 at at 250 2020-07-29 21:25 libtest/
drwxr-x--- 1 at at  72 2020-07-29 21:25 libunwind/
drwxr-x--- 1 at at 234 2020-07-29 21:25 stdarch/
drwxr-x--- 1 at at 144 2020-07-29 21:25 tools/
# ls -l /home/at/.rustup/toolchains/nightly-2020-07-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library
total 0
drwxr-x--- 1 at at  50 2020-07-29 21:17 alloc/
drwxr-x--- 1 at at  50 2020-07-29 21:17 core/
drwxr-x--- 1 at at  26 2020-07-29 21:17 panic_abort/
drwxr-x--- 1 at at  26 2020-07-29 21:17 panic_unwind/
drwxr-x--- 1 at at  36 2020-07-29 21:17 proc_macro/
drwxr-x--- 1 at at  42 2020-07-29 21:17 profiler_builtins/
drwxr-x--- 1 at at  36 2020-07-29 21:17 rtstartup/
drwxr-x--- 1 at at  32 2020-07-29 21:17 rustc-std-workspace-alloc/
drwxr-x--- 1 at at  50 2020-07-29 21:17 rustc-std-workspace-core/
drwxr-x--- 1 at at  50 2020-07-29 21:17 rustc-std-workspace-std/
drwxr-x--- 1 at at  66 2020-07-29 21:17 std/
drwxr-x--- 1 at at 234 2020-07-29 21:17 stdarch/
drwxr-x--- 1 at at  26 2020-07-29 21:17 term/
drwxr-x--- 1 at at  26 2020-07-29 21:17 test/
drwxr-x--- 1 at at  42 2020-07-29 21:17 unwind/
@jonas-schievink
Copy link
Contributor

I was wondering why it stopped resolving std paths... Fallout from rust-lang/rust#73265

@jonas-schievink
Copy link
Contributor

Hmm, this still seems to be broken when editing on rustc

@lnicola
Copy link
Member

lnicola commented Jul 31, 2020

Do you think that's related to this issue or to the fix in #5586? I'm not sure how it finds the rust-lang/rust stdlib.

@jonas-schievink
Copy link
Contributor

Not sure either, I haven't looked into this yet. There's no error message from rust-analyzer though.

@jonas-schievink
Copy link
Contributor

Ah, looks like this was a local problem. I had RUST_SRC_PATH set to src in my Rust checkout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants