In this release, we enable the new name resolution engine by default. Since this fundamental change has been made, we decided to increase the version of our plugin from 0.3 to 0.4. So, meet the IntelliJ Rust 0.4!

New Features

  • #7140 Enable new name resolution engine by default. Our new algorithm uses the fixed-point iteration approach and aims to provide better support for complex glob imports (use foo::*) and re-exports (use foo as bar). Here is list of improvements offered by new engine:

    • Properly support textual scoping when resolving macros
    • Resolve of multi-segment macro paths and macro calls inside files included by include!
    • Resolve of macros 2.0
    • Support file-level #![macro_use] and cfg attributes
    • Find all possible impl blocks for a type alias. Previously, for performance reasons, they were processed only when the number of aliases for the corresponding type didn’t exceed 10. Now the crates that heavily use type aliases, such as nalgebra or winapi, can be resolved properly

    Note that the new algorithm works for top-level items only, so local variables and type inference functionality won’t be affected. If you run into an issue with the new engine, you can switch it back to the old one via Use new name resolution engine option in Settings | Languages & Frameworks | Rust settings

  • #6456 Add initial Windows Subsystem for Linux (WSL) support. It is available since 2021.1, and can be enabled using org.rust.wsl experimental feature. Note that if there are both local Windows and WSL toolchains, the local one will be selected automatically. You can manually specify desired WSL toolchain location with \\wsl$ path in Settings | Languages & Frameworks | Rust settings. We plan to improve toolchain selection in the future

  • #7102, #7165 Annotate unknown cfg predicates and provide a quick-fix to use a proper one. This corresponds to the E0537 compiler error (by @Kobzol)

  • #6832 Complete target triples in Cargo run configuration and Run Anything dialog. Suggest installing the target if it is not yet installed

    Target triple completion in cargo run configuration

  • #7098 Support basic name resolution of macros 2.0 (pub macro name() { ... })

Performance Improvements

  • #7181 Slightly optimize project model update when using new name resolution engine

Fixes

  • #7174 Cancel external linter process immediately when some file is changed. Previously, in some cases, the process might hang

  • New name resolution fixes:

    • #7184 Resolve procedural macros through #[macro_use] on extern crates

    • #7167 Fix exception when removing a crate from the workspace

    • #7152 Fix unexpected name resolution after crate rename

  • #7178 Take into account enum’s lifetimes in Needless Lifetimes inspection

  • #7063 Now Can't find crate annotation highlights only unknown identifiers and can be suppressed. Also, its highlighting style was changed to unknown symbol (instead of error)

Internal Improvements

  • #7162 Speed up check workflow on CI

  • #7160 Simplify writing proc macro tests

Full set of changes can be found here