racer-rust/racer

Path is not automatically detected on OSX

adaschevici opened this issue · 7 comments

Hi,

I've updated OSX to the last supplemental update and completion seems to have stopped working.
the rust-src component path seems to no longer be detected accurately.
Setting it manually seems to not work very well as it can't find libstd

it seems this path no longer exists:
export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"

Versions:
rustc 1.47.0-nightly (8e21bd063 2020-08-14)
rustup 1.22.1 (b01adbbc3 2020-07-08)
racer 2.1.37

Not sure what i am missing

It seems like on 2020-07-29 the src directory was removed and the library directory was introduced. 2020-07-28 build has the src directory, and 2020-07-29 has the library directory.

I work around this by making RUST_SRC_PATH points to a stable release which do contains a src folder (something like .rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src).

@Jaden-Giordano as per @mapkts suggestion i did a manual install of the but libstd seems to be missing in the clone of the rustc repo as described in the manual install section of racer, so still seems like something is missing

Further, the libstd directory seems to be missing in nightly. This directory is used to validate the src path:

} else if !path.join("libstd").exists() {

So, I get the following error:

$ export RUST_SRC_PATH=~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/

$ racer complete 3 9 main.rs /tmp/racerABCDE
Unable to find libstd under RUST_SRC_PATH. N.B. RUST_SRC_PATH variable needs to point 
to the *src* directory inside a rust checkout e.g. "/home/foouser/src/rust/src". Current value 
""/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/libstd""

$ ls /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/
alloc         profiler_builtins          stdarch
backtrace     rtstartup                  term
core          rustc-std-workspace-alloc  test
panic_abort   rustc-std-workspace-core   unwind
panic_unwind  rustc-std-workspace-std
proc_macro    std

I did not find any resources on the renaming of these directories, maybe there are even more changes. Anybody else knows something about this?

Better title for this issue would maybe be "rust-src directories have been renamed in nightly" as it does not only affect MacOS.

Looks like the new layout is already handled

// Secondly, try the new standard library layout, e.g. std/src/lib.rs

so maybe it just a matter of removing that assert.

So its actually fixed in master e669f6b

Fixed some related issues in 3bcf543 and racer-rust/emacs-racer#144