racer-rust / emacs-racer

Racer support for Emacs
399 stars 48 forks source link

Missing docs => cryptic error message #80

Closed t0suj4 closed 7 years ago

t0suj4 commented 7 years ago

So I've ran racer-mode for the first time ever... and racer errored out on missing docs, I think this case should be covered by an appropriate error message.

Wilfred commented 7 years ago

Sorry, I don't quite understand. What's missing docs? Your code, racer itself, or the racer.el code?

What's the output of M-x racer-debug?

t0suj4 commented 7 years ago

I did not have rust sources where racer expects them, the error from racer.el was not clear enough. I have fixed it now. Please, improve the error message.

Wilfred commented 7 years ago

What error message did you get? What's the output of M-x racer-debug?

t0suj4 commented 7 years ago
The last racer command was:
$ cd /home/t0suj4/test/rust/rtags-rs/
$ export CARGO_HOME=/home/t0suj4/.cargo
$ export RUST_SRC_PATH=/home/t0suj4/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src
$ /usr/bin/racer complete 14 4 /home/t0suj4/test/rust/rtags-rs/src/main.rs /tmp/racer10403dVn

This command terminated with exit code 1.

stdout:

racer can't find the directory pointed to by the RUST_SRC_PATH variable ""/home/t0suj4/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src"". Try using an absolute fully qualified path and make sure it points to the src directory of a rust checkout - e.g. "/home/foouser/src/rust/src".

No output on stderr.

The temporary file will have been deleted. You should be
able to reproduce the same output from racer with the
following command:

$ CARGO_HOME=/home/t0suj4/.cargo RUST_SRC_PATH=/home/t0suj4/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src /usr/bin/racer complete 14 4 /home/t0suj4/test/rust/rtags-rs/src/main.rs

Please report bugs on GitHub.

Message in minibuffer is

eldoc error: (user-error /usr/bin/racer exited with 1. ‘M-x racer-debug’ for more info)
mgsloan commented 6 years ago

Argh, I'm running into this as a new rust user. @t0suj4 Can you please be more specific than I have fixed it now.? What did you do to fix it?

mgsloan commented 6 years ago

Woohoo, from https://github.com/rust-lang-nursery/rustup.rs/issues/878 I deduced that the resolution is rustup component add rust-src. Please add this to the error message if ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib is present but ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src is absent.

Wilfred commented 6 years ago

@mgsloan that's a good idea, but that will need to be added to racer itself rather than the Emacs package. Would you mind opening a bug on racer?

mgsloan commented 6 years ago

@Wilfred Good point! That's even better that the logic is in racer itself, no need to have similar logic in all the editor integrations. I've opened a PR https://github.com/racer-rust/racer/pull/797 :D