racer icon indicating copy to clipboard operation
racer copied to clipboard

"Unable to find libstd under RUST_SRC_PATH"

Open kfrncs opened this issue 4 years ago • 1 comments

When I run racer complete std::io::B, I get this:

Unable to find libstd under RUST_SRC_PATH. N.B. RUST_SRC_PATH variable needs to point to the *s│ rc* directory inside a rust checkout e.g. "/home/foouser/src/rust/src". Current value ""/home/ken/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd""

Despite the fact that my ~/.zshrc contains:

export RUST_SRC_PATH=${HOME}/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src

Any help would be appreciated.

kfrncs avatar Oct 19 '20 00:10 kfrncs

On my setup anyway, rustup component add rust-src puts the source in "$(rustc --print sysroot)/lib/rustlib/src/rust/library". There is no src directory, but racer works when pointed to that library dir.

$ export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/library"
$ racer complete std::io::B
MATCH BufRead,1781,10,path.../rustlib/src/rust/library/std/src/io/mod.rs,Trait,pub trait BufRead: Read
MATCH Bytes,2397,11,path.../rustlib/src/rust/library/std/src/io/mod.rs,Struct,pub struct Bytes<R>
MATCH BufReader,53,11,path.../rustlib/src/rust/library/std/src/io/buffered.rs,Struct,pub struct BufReader<R>
MATCH BufWriter,448,11,path.../rustlib/src/rust/library/std/src/io/buffered.rs,Struct,pub struct BufWriter<W: Write>

YMMV

jsoverson avatar Oct 20 '20 17:10 jsoverson