IntelliJ Rust + WSL2 - "Invalid toolchain location"

Hi all - trying to get the Rust plugin working on IntelliJ (CLion in this case) and am failing. No matter what, I'm getting the error Invalid toolchain location: can't find Cargo in \home\wbiggs\.cargo\bin.

The toolchain version gets populated (1.63.0), so it's at least kinda seeing that it's there, but the standard library field stays blank.

which cargo gives /home/wbiggs/.cargo/bin/cargo, so this is the right location. rustc is present in the directory as well.

I can't find anyone else who's had this issue recently and I'm not sure what I could be doing wrong. Thanks all!

How are you configuring the toolchain? You should be doing it via the "Languages & Frameworks > Rust > Toolchain location" window. It seems as if you could also do it via run configuration target "Run on" option, but I recall it not working for me.

Yeah, that's where I am.

Strange. The appropriate bug says everything should work (if you are no using Arch, anyway).

Do you have the org.rust.wsl Experimental Feature enabled? You can find Experimental Features via Search Anywhere window.

Somewhy I can't detect WSL toolchains even for C++. The spinners just spins indefinitely. This may mean that something is broken in the recent release of CLion.

Yeah, I checked and it is enabled... weird.


Are there any logs I can post or something like that that would help to figure this out? I'm on Windows 10 with Ubuntu 20.04 as my WSL2 distro.

CLion does successfully detect the build tool and C++ compiler for me, which makes me doubt a little that this is a CLion-WSL2 issue, but it could still be.

What if you put the wsl path in the toolchain location field instead of the windows location? That is /home/wbiggs/.cargo/bin. Maybe that works?

I have tried that; the only difference is that the "toolchain version" becomes "N/A", which seems like a stronger failure than what is currently happening.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.