Search code examples
intellij-idearusthomebrew

How to provide standard library sources for IntelliJ IDEA's Rust project?


I am using Mac for development. I installed Rust 1.13.0 using brew install rust and the Rust plugin 0.1.0.1385 for IntelliJ IDEA. I created my first test project with cargo and while opening it with IDEA I got the message

No standard library sources found, some code insight will not work

I haven't found any sources installed, nor the Rust sources package in Homebrew.

How do I provide sources for the project and what are the practical implication if I ignore this step?


Solution

  • As commented, the supported approach is to use rustup:

    • Navigate to https://rustup.rs/ and follow the installation instructions for your platform.
    • Add the rust-src component by running: rustup component add rust-src
    • Create a new Rust project in IntelliJ and choose your existing Rust project source. If the folder already contains previous IntelliJ project files, you may have to delete those first before it will let you proceed.
    • IntelliJ-Rust should automatically configure the standard library sources to point to the sources downloaded by rustup.