New Features

  • Cargo features and cfg support improvements:
    • Take into account attributes under cfg_attr attribute during type inference, name resolution, and other analysis. Now the corresponding features work as expected with code containing attributes like cfg_attr(..., derive(...)), cfg_attr(..., path="..."), etc.

    • Fairly evaluate unknown cfg options to false if there is no custom build script (build.rs) in the package. Previously, in order to avoid wrongly disabling the actual code, unknown cfg options and unknown Cargo features were considered enabled and disabled simultaneously. Note, you can turn on the new logic for packages containing build.rs as well by enabling the experimental build script evaluation: just enable org.rust.cargo.evaluate.build.scripts in Help | Find Action | Experimental Features dialog

    • Improve cfg(test) processing for external dependencies by providing a new heuristic. Now cfg(test) is treated as disabled if there is a cfg(not(test)) condition in the project. Previously, test option was considered enabled and disabled simultaneously, i.e. code under cfg(test) and cfg(not(test) was both enabled. Such test attributes are quite complex to handle in the IDE: the tests should not be conditionally disabled since you might want to read and edit them at any time; but only mock objects should be disabled and excluded from code analysis. So the current logic behind that is to disable “test” code only when “mocking”, i.e. when there is a cfg(not(test)) somewhere in the code. Note, this new logic currently affects the external dependencies only, excluding your workspace, in order not to break down the code insight for your tests.
  • Introduce rename refactoring suggestions for local variables. Now you will see a special hint to rename all usages when changing a local variable name in the editor (by @Kobzol)

  • Add basic support for overridden toolchains. Note, multiple overridden toolchains in a single IDE project are still unsupported
  • Resolve URLs in Cargo.toml (e.g. in dependency git links). Now you can open URL specified in git, homepage, repository, and documentation fields (by @Kobzol)
  • Provide folding for TOML files. Currently, it supports tables, arrays, and custom folding regions (by @Kobzol)

  • Incrementally update experimental local crates index. This speeds up the experimental Cargo.toml dependency completion. In the future, this would affect other new code insight based on the local crates index as well. Note, the corresponding feature is disabled by default for now. You can enable it via org.rust.crates.local.index option in Experimental Feature dialog (Help | Find Action and type Experimental features to open the dialog)

Fixes

  • New name resolution engine improvements:
    • Support #![macro_use] attribute at file level

    • Properly process items with restricted visibility that contains an absolute path, e.g. pub(in crate::inner1)

    • Fix name resolution of qualified macro calls inside items in some cases

    • Properly handle renaming of enum variants

    Note, you can enable the new engine via Use experimental name resolution engine option in Preferences | Languages & Frameworks | Rust settings

  • Fix name resolution and completion of Self keyword for nested structs, enums, and impl blocks
  • Improve the new Fill function arguments quick-fix (by @Kobzol)
    • Support filling arguments of a closure call
    • Take actual types into account when constructing default values of generic types
  • Remove parameter quick-fix no longer removes references to the modified function (by @Kobzol)
  • Fix resolution of Cargo features for aliased packages like foo_alias = { package = "foo", path = "../foo"}
  • Fix Trait implementation inspection on impl blocks containing macro-expanded members
  • Improve parser recovery and syntax error messages for incomplete paths

Internal Improvements

  • Introduce TomlVisitor. This class can be used to implement inspections in TOML files in a simple and efficient way (by @Kobzol)
  • Introduce message bundle to collect user-visible string literals and localize them in the future
  • Set milestones automatically for pull requests from forks. Previously, it worked only for pull requests in the original repository
  • Provide regression testing on CI for stdlib packages

Full set of changes can be found here