Open devurandom opened 6 years ago
Is it possible, that what IntelliJ Rust actually wants, is the path to the Rust source code containing a "libstd" directory?
In which case it might get a little bit more automatism by looking at src/Cargo.toml and seeing that this is a copy of the Rust source code, and ask me whether I want to use that one.
I'd like to assign this to myself, if possible, and see whether I can come up with some wording that's more detailed and easier to understand.
Please note that #2275 does NOT yet detect that the currently open project is a copy of the Rust source code and hence it does not yet offer the user to just use this source.
I have also tried to solve this by providing the path "/usr/lib/rustlib/src/rust/src/libstd" but it is not being accepted :(
Edit: Go with /usr/lib/rustlib/src/rust/src
.
The problem still exists in the latest IJ (Build #IU-182.3911.13), Rust plugin Version: 0.2.0.2101-182.
In my case the problem seemed to be with rust installed via brew. After brew uninstall rust
I followed installation instructions here https://www.rust-lang.org/en-US/install.html, i.e. curl https://sh.rustup.rs -sSf | sh
. I had to point IJ to ~/.cargo/bin/rustc
in a UI dialog but the error message was gone.
Faced the same problem, that's because I was following setup instructions from TheBook.
To prove it won't work type $ which rustup
and it won't answer.
So to avoid that in IDEA you should uninstall Rust first:
run /usr/local/lib/rustlib/uninstall.sh
as root to uninstall Rust
follow installation instructions on https://www.rust-lang.org/en-US/install.html or just $ curl r/[https://sh.rustup.rs](https://sh.rustup.rs) \-sSf | sh
now $ which rustup
should work, copy that path to IDEA.
now it will loose the toolchain, which is here: /home/username/.cargo/bin
and the standard library, IDEA will tell it can download it
Now it works.
I can confirm this issue, create a new project from Rust application binary template and receive no explicit stdlib or rustup
, but in my case I've installed rust 1.32.0 from my package manager. adding the path /usr/lib/rustlib/src/rust/src when the proyect is being created or later on the project settings solves the issue
On macOS had the same issue, with both InelliJ and CLion, and like @dkandalov I had Rust initially installed with Homebrew. With CLion I was able to build (IntelliJ kept complaining about missing SDK), but the error message was annoying. It looks like Homebrew does not install the sources, if I understand the problem correctly.
To get rid of it, I first uninstalled Rust: brew uninstall rust
, brew cleanup
. Then I installed rustup-init
, and then with it I installed rustup
(yes, I could have installed rustup
manually, but I try to use as much as possible Homebrew and Sdkman):
brew install rustup-init
rustup-init
with some interactive options, downloads and installs Rust and rustup
.After that, in the welcome dialogue I've let CLion retrieve the standard library:
Configure > Preferences > Languages & Frameworks > Rust > 'Download via rustup'
The library is then in /Users/USERNAME/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src
:
New projects then have the settings already.
I was in the process of filling out an addition to this thread as I thought I had this problem, but I found a related issue. I hadn't personally gone into the global settings or project settings and set the Rust toolchain preferences as they were being autofilled at project creation time. However, I was still getting the issue reported above. While in the project (and global) settings, if I navigated to the Rust settings, the settable fields would be empty then autofill with the Apply button ready to be pressed. Once doing so the plugin works fine. It seems the settings (though showing correctly initially) actually weren't being set in the background.
CLion: 2019.3.4 Rust: 0.2.116.2163-193
rustup did not successfully install and configure the stable toolchain, you can do it manually(in $home/.cargo/bin): rustup install stable rustup default stable after that, restart idea
rustup did not successfully install and configure the stable toolchain, you can do it manually(in $home/.cargo/bin): rustup install stable rustup default stable after that, restart idea
This helped me. As an Arch user, I ran these commands to essentially reinstall Rust the way PyCharm wanted me to (I guess?):
sudo pacman -S rustup
When it asks to remove Rust since it's in conflict, answer Y.
rustup toolchain install stable
Restart the IDE
on MacOS, adding the rust path in global PATH worked for me
sudo echo $HOME/.cargo/bin>>/etc/paths
rustup did not successfully install and configure the stable toolchain, you can do it manually(in $home/.cargo/bin): rustup install stable rustup default stable after that, restart idea
This helped me. As an Arch user, I ran these commands to essentially reinstall Rust the way PyCharm wanted me to (I guess?):
sudo pacman -S rustup
When it asks to remove Rust since it's in conflict, answer Y.rustup toolchain install stable
Restart the IDE
Worked for me. Thanks!
as a linux user, i solved this problem by uninstall rust and install rustup using
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
and restarting the ide should finish the work
I think I know how to fix this issue for Windows 10 +. The toolchain location and standard library location is different with in the documents. Just set paths like following: toolchain location: C:\Users[username].rustup\toolchains\stable-x86_64-pc-windows-msvc\bin standard library: C:\Users[username].rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
When working on the Rust source code itself, IntelliJ Rust complains "Cargo project update failed: no explicit stdlib or rustup found". I am not sure what this means, exactly.
Further, IntelliJ Rust says at the top of any file that it "Can not attach stdlib sources automatically without rustup", but when I try to "Attach manually", it tells me that "Invalid Rust standard library source path: <.../rust/src/libstd>", where rust/src/libstd is the path to the source code of libstd. What exactly is IntelliJ Rust search for, when it asks for the location of that library source code?
It appears that these error message could be enriched to make it easier for the user to solve the issue. I would be glad to contribute such a patch, but am unable to do so without additional help and information.