9

I installed the multirust version of the Rust programming language. I was trying to configure the racer code completion package to point to the Rust source code through the RUST_SRC_PATHenvironment variable. However, I can't seem to find the location of the rust source files. When I type which rustc I am pointed to /usr/local/bin probably because there is a symlink to the actual source directory or something. Any info on where the proper directory for the RUST_SRC_PATH variable is for multirust?

krishnab
  • 9,270
  • 12
  • 66
  • 123
  • What does `ls -l /usr/local/bin/rustc` tell you? – tckmn Nov 24 '15 at 18:51
  • It tells me: ` ls -l /usr/local/bin/rustc -rwxr-xr-x 1 root root 2889 Nov 24 13:24 /usr/local/bin/rustc` – krishnab Nov 24 '15 at 18:52
  • There is a `~/.multirust/toolchains/stable/bin` folder in my home directory. Would that be the correct one to use. There is a `rustc` and a `cargo` file in there. – krishnab Nov 24 '15 at 18:55
  • Re: your first comment, that means that it's not a symlink. The `.multirust` directory does sound promising. – tckmn Nov 24 '15 at 19:01

2 Answers2

14

By default, rustup doesn't install the source code for the Rust standard library. But you can execute the following command to install it:

$ rustup component add rust-src

The source is installed in ~/.rustup/toolchains/$TOOLCHAIN/lib/rustlib/src/rust/src/ (where $TOOLCHAIN is the name of a toolchain you use).

Francis Gagné
  • 60,274
  • 7
  • 180
  • 155
Yuvaraj Loganathan
  • 781
  • 11
  • 15
6

Currently, multirust doesn't install the source. This is also mentioned in the context of using racer with multirust.

Instead, follow the instructions in the Racer README:

Fetch the Rust sourcecode from git, or download from https://www.rust-lang.org/install.html

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
  • Okay interesting. So I am a little confused because I had installed rust using the rustup.sh script initially. Then when I installed multirust, the installer asked me to uninstall the previous version of rust. So I uninstalled the rustup.sh version of rust. But you are saying that multirust does not install the source? So I am just trying to understand where I should be looking or something. Am I missing something? – krishnab Nov 24 '15 at 19:15
  • Here is the specific notation from the multirust github site indicating that I need to uninstall any previously installed rust version. "Installation of multirust over an existing installation of Rust or vice versa will cause brokenness. Uninstall the other first. ./install.sh will detect this and error. This should be fixable in the future." Any clarification would be appreciated. Thanks so much. – krishnab Nov 24 '15 at 19:22
  • @krishnab To my knowledge, none of the official Rust installers (which is what `rustup.sh` runs) include the Rust source. The issue I linked shows that multirust does not install the Rust source. [The README for Racer says](https://github.com/phildawes/racer) " Fetch the rust sourcecode from git, or download from https://www.rust-lang.org/install.html ". – Shepmaster Nov 24 '15 at 19:25
  • Okay got you. So I used git to download the rust src and then used that for the environment variable. I will note this on the stackexchange answer. Thanks for your help. – krishnab Nov 24 '15 at 19:53