How do you compile "racer" when you're using "stable"?

Howdy! I noticed that racer doesn't seem to build with the stable Rust release. I'm not very interested in running nightly as such (I don't want to use any cutting edge features) but I do want to have advanced IDE features in my editor. Do I simply have to bite the bullet and switch to nightly if I want to use racer?

Alternatively you can use the rust language server, as far as I remember it's stable since 1.30ish.

It seems to use racer as a dependency.

Does adding the RLS as a component via rustup fail with an error?

Anyway, you can compile racer with nightly and still use it for stable and beta projects.

Excellent to hear I can compile racer with nightly and still use the stable toolchain! Please tell me how to build racer using nightly and then have it around for stable/beta. I have no idea what I'm doing.

How are you attempting to install it? If you're using rustup the following command should work with stable rust:

rustup component add rls rust-analysis rust-src


It doesn't seem like there's a documented way of doing this without rustup, it may require manually compiling it with nightly.

Answering my own question, after much experimentation:

rustup allows you to install more than one toolchain, and to switch easily between them. The correct method, presuming one already has stable installed, is:

rustup toolchain install nightly
rustup default nightly
cargo install racer
rustup default stable

This will, in sequence, install the nightly toolchain, switch to it, install racer, and then switch back to stable.

Edited to add:

As @Hyeonu explains below, you can also build off a non-default toolchain. So an even simpler solution (assuming you are on stable) is:

rustup toolchain install nightly
cargo +nightly install

The +nightly tells cargo to build using the nightly toolchain without needing to switch to it.

You can cargo +nightly install racer to achieve same result.


Thank you! I knew that there had to be a better way!! Does that require that nightly already be installed?

I believe so, but nightlies always installed in my machine so I can't be sure though :stuck_out_tongue:

1 Like

BTW, thanks so much for your answer! You understood what I was asking and gave me clear instructions, which is really helpful for a newcomer.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.