在 Gentoo 上的 IntelliJ IDEA 中,由于 gentoo 不使用 rustup,我该如何附加 rust stdlib 源代码? [英] In IntelliJ IDEA on Gentoo, how do I attach the rust stdlib sources since gentoo does not use rustup?

查看:81
本文介绍了在 Gentoo 上的 IntelliJ IDEA 中,由于 gentoo 不使用 rustup,我该如何附加 rust stdlib 源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IDEA (2018.2.3) 中使用 IntelliJ 的 rust 插件(版本 0.2.0.2114-182).

我的编辑器窗口顶部有一个黄色栏,上面写着不能在没有 rustup 的情况下自动附加 stdlib 源".这并不奇怪,因为 gentoo 不使用 rustup.它从源代码编译 Rust.

有一个选项可以手动附加",但我不知道它要我选择哪个目录;甚至我应该寻找什么来找出正确的目录是什么;而且我什至不确定 gentoo ebuild 是否创建了一个包含必要的 stdlib 源代码的目录.

如何以与 gentoo 的包管理系统兼容的方式向 rust 插件提供 stdlib 源代码?这似乎是

我相信这是一个在 Gentoo 上比绕过 portage 和/或使用 rustup 更惯用的解决方案.

请注意,dev-lang/rust-bin 包目前可以没有 rls 使用标志,我还没有找到用它安装 Rust lib 源代码的方法.

Gentoo 中有关 dev-lang/rust use-flags(及其文档)的贡献可能会受到赞赏.

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.

解决方案

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.

这篇关于在 Gentoo 上的 IntelliJ IDEA 中,由于 gentoo 不使用 rustup,我该如何附加 rust stdlib 源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆