Vscode-rust: GoTo Definition for items in the standard library fails, probably looking in wrong place for source

Created on 12 Feb 2018  路  9Comments  路  Source: rust-lang/vscode-rust

When I press F12 GoTo Definition on standard library functions I either get "No definition found for foo"

no_defn_for_retain

or a file not found error

file_not_found

It is not predictable as to which I get - you always get the same error for a particular function, but there is no way of predicting which one. Note the path is wrong in the gif, I actually have the source installed here:

C:\Users\Phil\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src

Expectation: Should find the appropriate rust-src and take me there.

OS               : Windows 10
VS Code          : 1.19.3
rls plugin       : 0.3.2
cargo --version  : cargo 0.24.0 (45043115c 2017-12-05)
rustup --version : rustup 1.10.0 (c6a8f7c60 2018-01-25)
rustup show      : stable-x86_64-pc-windows-msvc (default)
rls --version    : prints "error: toolchain 'stable-x86_64-pc-windows-msvc' does not have the binary `rls.exe`"
    I do have another rls.exe at C:\Users\Phil\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rls.exe
    I am not sure which one the plugin is using.

Everything was installed via rustup and cargo.

Possibly related issue: https://github.com/rust-lang-nursery/rls-vscode/issues/185 But that is talking about it always failing. For me, GoTo Definition works OK for my own source and for source in crates I am using. It's just the std stuff that doesn't work.

P-High bug

Most helpful comment

After an recent rustup update to nightly, go-to-def now _only_ works on my own source. It doesn't work for std, nor for crates I use.

All 9 comments

After an recent rustup update to nightly, go-to-def now _only_ works on my own source. It doesn't work for std, nor for crates I use.

Not jumping into std is a known issue, but not jumping to dep crates is a new bug

I am using stable-msvc, and my vscode tried to find src in file:///c:/Program Files/Microsoft VS Code/src/libstd/io/mod.rs.
Even though I've set env RUST_SRC_PATH=C:\Users\KaneGreen\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src

Any progress?

FYI use this config

{
    "rust-client.channel": "nightly"
}

Then reload window, should works.
Somehow the stable channel are buggy, and not catching up with the fixes on the nightly.

@nrc This seems to be broken again for me (even with nightly): https://github.com/rust-lang-nursery/rls-vscode/issues/391

Given the fact I also have the problem with atom https://github.com/rust-lang-nursery/atom-ide-rust/issues/96, it might be a regression in RLS?

Can anyone confirm whether or not the extension works for std and external crates? Thanks

By the way: it's not just GoTo Definition, also type information etc. is currently not working for me outside the current crate.

Yeah, currently you can jump to def into an external crate, but once there you don't get any further help from the RLS (this is a client problem, but is a bit hard to fix and affects multiple clients).

Was this page helpful?
0 / 5 - 0 ratings