Skip to content

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

Closed

Description

@ivan

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/

Activity

  1. jonas-schievink commented on Jul 29, 2020

    @jonas-schievink
    Contributor

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

  2. self-assigned this
    on Jul 30, 2020
  3. added a commit that references this issue on Jul 30, 2020
    5844dd0
  4. jonas-schievink commented on Jul 30, 2020

    @jonas-schievink
    Contributor

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

  5. lnicola commented on Jul 31, 2020

    @lnicola
    Member

    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.

  6. jonas-schievink commented on Jul 31, 2020

    @jonas-schievink
    Contributor

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

  7. jonas-schievink commented on Jul 31, 2020

    @jonas-schievink
    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions