rustjetbrains-iderust-cargorustrover

RustRover - Load Cargo Changes button not working for project in subdirectory


I`m encountering some issues with RustRover. I want to set up a project structure like this:

 / My project (aka the main folder in the IDE)
   - .gitignore
   / cli
     - cargo.toml
     - ..etc
   / lib
     - cargo.toml
     - ..etc

For building or running the project this works perfectly fine. However, for updating crates etc. Jetbrains uses this button:

enter image description here

This will cause the following error in the Sync panel:

Execution failed (exit code 101).
/Users/pascaldachard/.cargo/bin/cargo metadata --verbose --format-version 1 --all-features --filter-platform aarch64-apple-darwin
stdout : error: could not find `Cargo.toml` in `/Users/pascaldachard/Desktop/proj/repo/rust/common/pascal_cli` or any parent directory

stderr : 

I can't find a place where i can further edit the config for cargo. I set up my run/debug configurations correctly. Anyone have any idea how to fix this? I'd be fine with a better solution for structuring my project, but i tried a nested structure before and that also gave similar issues with rustrover.


Solution

  • If it is possible for the projects to share a Cargo.lock, you can create a Cargo Workspace and add these folders to the workspace. https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html

    That said, I think JetBrains IDE's work well if you open each module/subproject in separate tabs. Memory consumption is not linear to the tabs.

    I think multi-module projects are never a good idea when you reach a certain project size threshold.