Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issues related to RUST_SRC_PATH #144

Closed
xuyizhe opened this issue Oct 15, 2020 · 0 comments
Closed

Fixed issues related to RUST_SRC_PATH #144

xuyizhe opened this issue Oct 15, 2020 · 0 comments

Comments

@xuyizhe
Copy link
Contributor

xuyizhe commented Oct 15, 2020

I just fixed some issues related to rust-src, maybe it works for you.

$ rustc --version
rustc 1.48.0-nightly (0da580074 2020-09-22)

$ racer --version
racer 2.1.39

1. Racer

  • You've set the environment variable RUST_SRC_PATH

Now update src to library.

# .zshrc/.bashrc/.bash_profile
export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/library"

# ~/.spacemacs.env for spacemacs user. (Replace username and rust version)
RUST_SRC_PATH=/Users/<USER NAME>/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library
  • You prefer the path to be found automatically

I fixed it in master racer-rust/racer@3bcf543. You can manually compile before the next release version.

2. Emacs

I created a PR #143 to fix. Or you can do a quick fix:

(setq racer-rust-src-path
      (let* ((sysroot (string-trim
                       (shell-command-to-string "rustc --print sysroot")))
             (lib-path (concat sysroot "/lib/rustlib/src/rust/library"))
              (src-path (concat sysroot "/lib/rustlib/src/rust/src")))
        (or (when (file-exists-p lib-path) lib-path)
            (when (file-exists-p src-path) src-path))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant