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

let racer locate rust sources by default #56

Closed

Conversation

ccmtaylor
Copy link

Racer looks for Rust sources by calling rustc --print sysroot, if
$RUST_SRC_PATH is not set. This plays well with rustup's capability
to manage rust sources along with the rest of the toolchain.

To make use of this heuristic, we no longer require a source path to be
explicitly configured by the user.

fixes #54.

Racer looks for Rust sources by calling `rustc --print sysroot`, if
`$RUST_SRC_PATH` is not set. This plays well with rustup's capability
to manage rust sources along with the rest of the toolchain.

To make use of this heuristic, we no longer require a source path to be
explicitly configured by the user.
(format "CARGO_HOME=%s" cargo-home))
process-environment)))
(process-environment
(append
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned in #54, this is the first time I'm writing elisp, so I'd appreciate feedback if this is idiomatic.

@ccmtaylor
Copy link
Author

I just noticed that the latest racer release on crates.io is from May, so it doesn't include racer-rust/racer#598 yet :(

@Wilfred
Copy link
Member

Wilfred commented Oct 7, 2016

Interesting! Could we just call rustc --print sysroot directly, so we support all racer versions?

@Wilfred
Copy link
Member

Wilfred commented Nov 4, 2016

It doesn't look like rustup downloads sources by default, FWIW:

~ $ rustc --print sysroot
/home/wilfred/.multirust/toolchains/stable-x86_64-unknown-linux-gnu
~ $ find /home/wilfred/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/ -name \*.rs

Am I doing something wrong?

@ccmtaylor
Copy link
Author

I apologize for not answering for so long, @Wilfred! Rustup doesn't download sources by default, since they're quite big. You need to rustup component add rust-src, and from then on, rustup will keep sources in sync. The relevant issue is rust-lang/rustup#37.

If you scroll to the bottom, you'll find the reference to racer-rust/racer#595, with the intention of making source path discovery in racer default to rustup's location. I suppose we could call rustc --print sysroot ourselves, but I'm afraid that's beyond my elisp capabilities :(

@Wilfred
Copy link
Member

Wilfred commented Dec 27, 2016

Done in #72.

@Wilfred Wilfred closed this Dec 27, 2016
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

Successfully merging this pull request may close these issues.

Make racer-rust-src-path optional, as racer can now query rustc
2 participants