I am using IntelliJ's rust plugin (version 0.2.0.2114-182) with IDEA (2018.2.3).
There is a yellow bar at the top of my editor window that says "cannot attach stdlib sources automatically without rustup". This is not surprising since gentoo does not use rustup. It compiles rust from source.
There is an option to "attach manually", but I have no idea what directory it wants me to pick; or even what I should look for to figure out what the proper directory is; and I'm not even sure the gentoo ebuild created a directory with the necessary stdlib sources.
How can I provide the stdlib sources to the rust plugin in a way that is compatible with gentoo's package management system? It seems like answers to How to provide standard library sources for IntelliJ IDEA's Rust project? bypass gentoo's ebuilds and might cause the accumulation of cruft over time.
Rust is supported in CLion via the IntelliJ Rust plugin, compatible with all IntelliJ-based IDEs. The plugin provides Rust language engine with a set of code insight features, Cargo support, and debugger functionality (in CLion and IntelliJ IDEA Ultimate).
The source for Rust's standard library can be obtained by running rustup component add rust-src . It will be downloaded to the <toolchain root>/lib/rustlib/src/rust directory of the current toolchain.
The dev-lang/rust Gentoo package has an rls
use-flag (standing for Rust Language Server), which has a side-effect of installing Rust sources to /usr/lib/rustlib/src
:
$ equery files dev-lang/rust | grep lib.rs
/usr/lib/rustlib/src/rust/src/libcore/lib.rs
/usr/lib/rustlib/src/rust/src/libstd/lib.rs
(...)
The solution is therefore to enable the rls
use-flag and then point Intellij IDEA to /usr/lib/rustlib/src/rust/src
:
I believe this is a more idiomatic solution on Gentoo than to bypass portage and/or use rustup.
Note that dev-lang/rust-bin package currently does not have the rls
use-flag and I haven't found a way to install Rust lib sources with it.
Contributions regarding dev-lang/rust use-flags (and their docs) in Gentoo would be probably appreciated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With