JetBrains revs-up new engine for more IntelliJ Rust support

JetBrains revs-up new engine for more IntelliJ Rust support

As hinted at last week, code development tool provider JetBrains has just released version 0.3 of its IntelliJ Rust plugin – something especially popular amongst CLion IDE users trying their hand at Mozilla’s C++ challenger.

In its latest iteration, the plugin has been fitted with three new refactorings which are supposed to help Rust developers change the location of a module file and all related references, transform expressions into constants, and inline function bodies. It’s also the first version to support or_patterns, so that users can arbitrarily nest in a pattern. The feature is still in its early stages, meaning there is no code analysis for it yet, and can only be used with the nightly toolchain, once it has been invoked via the #![feature(or_patterns)] attribute.

One of the most highlighted changes in the 2020.2 release is the now new macro expansion engine. Compared to its predecessor, it uses disk memory instead of a system’s RAM to store its results, which can be indexed by the IDE. This wasn’t an option before, leading to issues when handling module declarations and impl blocks for example, which are also found in a number of macro-generated standard library methods. 

The changed behaviour not only reduces the number of RAM interactions which improves performance, but also provides additional code insight. Users should therefore run into less false-positives during inspections, while also getting correct highlighting, and code completion inside macro calls. 

In addition, it’s also worth noting that the new engine uses a separate phase to process macros, which can be useful to order expansion steps for more complex, nested module declarations. However, should the new engine fail to live up to its users expectations, switching to the old one is said to be as easy as changing the preferences under Rust in the languages and frameworks section of the IDE’s settings.

Though IntelliJ Rust can be used with a variety of JetBrains’ IDEs, it’s probably best paired with the company’s C/C++ product CLion. If both are on the most current version, the tools can be used to debug projects originally built on Windows with Rust’s MSVC toolchain thanks to a LLDB-based debugger bundled in CLion.

Rust is a Mozilla-driven multi-paradigm programming language which made its debut in 2010 and is inspired by C++ amongst others. With a focus on performance and safety, it seems to be of most interest to system developers – similar to Go, which can be seen as its main competitor amongst the newer languages. Integrations for a variety of widely known editors are available, with IntelliJ being the third choice behind Vim and VS Code, according to the latest Rust community survey.