CLion supports the Rust programming language via the IntelliJ Rust plugin, compatible with all IntelliJ-based IDEs. In addition to basic functionality, the CLion's implementation enables you to use the Cargo build system and debug Rust applications.
Starting a Rust project in CLion:
- Install the IntelliJ Rust plugin either directly from the Plugin Repository webpage or right from CLion: go to , click Browse repositories and type Rust in the search field, then click Install in the plugin description dialog.
- Install the Rust package using rustup.rs or other installation options.
- Start a new project (Rust in the list of available configurations. In the New Project dialog, provide the paths to the toolchain and the standard library (which can be downloaded via rustup right from the wizard): ) and choose
Working with Rust code
As mentioned above, the IntelliJ Rust plugin is being actively developed, and new features come with every version. Currently, the plugin's capabilities include:
- Smart editing, for instance, syntax highlighting, code formatting and code folding.
- On-the-fly code analysis:
- Navigation actions, e.g. Find Usage, Go to Class, Go to Super, and File Structure View.
- Code generation and refactoring options.
- Quick Documentation popup (Ctrl+Q), including documentation for library functions:
Running and debugging
To build, run and debug your Rust code, create a new Run/Debug configuration: in the Cargo Command from the drop-down list. Then specify the settings for your Cargo Command configuration:dialog, press and choose
Now CLion's debug features (breakpoints, variable monitor, stepping, and others) are available for your Rust application: