racer-rust / emacs-racer

Racer support for Emacs
399 stars 48 forks source link

Racer doesn't find the source for a function defined in a local crate #101

Open db48x opened 6 years ago

db48x commented 6 years ago

Perhaps I've configured it incorrectly? I had a very old copy of Racer installed which at some point stopped working, so today I'm finally trying to fix it. It's now mostly working, but here's a scenario that doesn't:

I've got a copy of Remacs checked out, and in rust_src/src/base64.rs there is the line

unsafe { LispObject::from_raw(make_unibyte_string(encoded, encoded_length)) }

I can use M-. to jump all of the identifiers on this line except make_unibyte_string. For LispObject and from_raw, it jumps correctly to their definitions in rust_src/src/lisp.rs. For encoded and encoded_length, it jumps a few lines up to where those local variables are defined. For make_unibyte_string I expected it to jump to rust_src/remacs-sys/lib.rs, which has the definition on line 1434. This is inside of a local crate, listed in the Cargo.toml file like this:

[dependencies]
remacs-lib = { version = "0.1.0", path = "remacs-lib/" }
remacs-macros = { version = "0.1.0", path = "remacs-macros" }
remacs-sys = { version = "0.1.0", path = "remacs-sys/" }
base64 = "0.9"
...

I've also checked that I can jump to items in the standard library, and to items from the base64 crate, but not to either of the local crates. I've also verified that I can jump to definitions inside these local crates if I'm starting from a file that is already in that crate.

racer-debug shows this racer command:

CARGO_HOME=/home/db48x/.cargo RUST_SRC_PATH=/home/db48x/.rustup/toolchains/nightly-2018-02-08-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src /home/db48x/.cargo/bin/racer find-definition 363 42 /home/db48x/projects/remacs/rust_src/src/base64.rs

It also shows that it's executing racer from the rust_src directory, so the Cargo.toml file is right there for it to find.

j0ni commented 5 years ago

Hey @db48x did you find a solution for this? I see the same problem.