intellij-rust icon indicating copy to clipboard operation
intellij-rust copied to clipboard

standard library path not fully customizable when not using rustup

Open eddy-geek opened this issue 6 years ago • 5 comments

OS: Fedora 28 Rust 1.24 installed with dnf install cargo rust-src

  • rust package installs /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib
  • rust-src package installs /usr/lib/rustlib/src/rust/src Giving that last path as "Standard library" did not work (message :

Cargo project update failed: invalid standard library: /usr/lib/rustlib/src/rust/src

However for some reason this works:

sudo ln -s /usr/lib/rustlib/src /usr/lib/rustlib/x86_64-unknown-linux-gnu/

then give /usr/lib/rustlib/x86_64-unknown-linux-gnu/src/rust/src as "Standard library"

I should not have to modify system files (but maybe I missed another way?). Maybe current setup is tailored to rustup default path structure?

Final config for reference: image

eddy-geek avatar Mar 23 '18 15:03 eddy-geek

+1 for the request

patrickallaert avatar Mar 30 '18 12:03 patrickallaert

I installed rust via homebrew for macOS. Had the same issue that I couldn't define the standard lib. looked around in the source code and found out why: https://github.com/intellij-rust/intellij-rust/blob/86396817d1d3e0965cc64a5879ab4689a6a7b067/src/main/kotlin/org/rust/cargo/project/workspace/StandardLibrary.kt#L37 . created a symlink as src and IntelliJ Rust is happy, though I am not but at least IDEA finally accepted the path.

166MMX avatar May 26 '18 17:05 166MMX

In fedora 32 Rust works in IntelliJ without any hacks

rustfc32

mariuszs avatar Aug 01 '20 20:08 mariuszs

Install "rust-src" package using sudo dnf install rust-src The Standard Library path mentioned in @mariuszs image will be available. You can manually type it into the box in case it is not automatically discoverd. Tested on fedora 32.

mmabdpr avatar Aug 23 '20 10:08 mmabdpr

I experienced the same issue on Fedora 36 with both IntelliJ and CLion. What I did to "fix" the problem is nearly the same thing as the OP's solution except the directory in the third step is slightly different:

  1. Install the Rust sources if not already installed sudo dnf install rust-src
  2. Create a symlink: sudo ln -s /usr/lib/rustlib/src /usr/lib/rustlib/x86_64-unknown-linux-gnu/
  3. Specify the updated directory in the IDE (there is no "src/rust/src" anymore it's just "src/rust"): /usr/lib/rustlib/x86_64-unknown-linux-gnu/src/rust

Afterwards, the message saying the IDEs can't attach the stdlib disappears.

Edit: Just a heads up for anyone reading, sometimes this temp-fix breaks depending on what I'm doing in the IDEs.

qualitysoftwareguy avatar Sep 03 '22 22:09 qualitysoftwareguy