Open ElectricCoffee opened 6 years ago
How are you setting RUST_SRC_PATH? It sounds like you've set it in a shell and Emacs is ignoring it.
You could set racer-rust-src-path
directly if you just want a quick fix.
The default logic is to either use RUST_SRC_PATH
(in the shell/environment Emacs is running in), or failing that we try rustc --print sysroot
, and failing that we fall back to /usr/local/src/rust/src.
I set it in my .bashrc file
@ElectricCoffee I suspect if you evaluate the lisp function (getenv "RUST_SRC_PATH") it will return nil. This the function you need to get working if you want racer.el to set racer-rust-src-path to your RUST_SRC_PATH for you. getenv, in part, searchs through the process-environment variable for the path. If you look through the content of that variable you'll probably won't see your path variable.
You should look at the section "Why am I getting a message about environment variables on startup?" here. I know you probably don't spacemacs, but the advice to not set environmental variables in your .bashrc might help you here. Short of that you probably just have a configuration issue that's not properly loading environmental variables.
~Confirming that if RUST_SRC_PATH
is not set anywhere, racer stops behaving erratically (it occurred me sometimes).~ I stand corrected, in my case I did not download the nightly src files:
$ rust install nightly
$ rustup component add rust-src
However, still curious about the rest of my comment.
So, now I'm a bit confused: is the RUST_SRC_PATH
env var needed at all or is it better to not set it? If the latter is true, the documentation should be amended consequently (and I'd gladly submit a tiny pr).
Perhaps related to https://github.com/racer-rust/racer/pull/799
Opinions?
@apiraino
is the RUST_SRC_PATH env var needed at all or is it better to not set it?
Now racer can work without RUST_SRC_PATH
, but I think you have no problem if you set it manually.
But, anyway I think we have to update README, so it's great if you submit a PR for it!
This is a bit of a curiosity.
I've set the RUST_SRC_PATH to point to the source directory:
But racer insists that the variable is set to
"/usr/local/src/rust/src"
via this error:I have a feeling that it's emacs that is doing the re-exporting of
RUST_SRC_PATH
, thus clashing with the existing one.I'm running Ubuntu 17.10, Emacs 25.2.2, Rust v. 1.21.0, and emacs-racer v. 1.2