New Features

  • #6992 Provide initial experimental support for custom derive procedural macros. Now the plugin can expand such procedural macro calls and take into account expanded impl items in type inference and name resolution (other types of items are ignored for now).
    Note, it’s only an initial implementation, so it may work in an unexpected way in some cases. The feature is disabled by default for now. To turn it on, you should enable Use experimental name resolution engine option in Preferences | Languages & Frameworks | Rust settings and enable org.rust.cargo.evaluate.build.scripts and org.rust.macros.proc experimental features. Don’t forget to reload a project structure after enabling the corresponding features via Refresh Cargo Projects action on Cargo tool window. See tracking issue for more details and the current status of procedural macros support

  • #7093 Now the plugin takes Cargo config into account during evaluation of cfg conditions. Note, it works since Rust 1.52.0 (currently in beta)

  • Introduce new intention actions:

    • #6845, #7115 Enable/Disable feature state to toggles feature state from a cfg attribute (by @Kobzol)

      By the way, we have a blog post about cargo features support

    • #7071 Share in Playground to share a selected Rust code on Rust Playground

      Previously, this feature was only available as Rust | Share in Playground action in Tools and context menus

    • #6960 Expand dependency specification for Cargo.toml

    • #6837 Create struct to create a struct from an unresolved struct literal (by @Kobzol)

  • #5650 Now Use destructuring declaration intention action replaces usages of destructured variable (by @Kobzol)

  • #6986 Allow specifying the function return type in Create function intention action if the inferred return type is unknown (by @Kobzol)

  • Improve code folding:

    • #7111 Support folding for multiline where clauses (by @Stzx)

    • #7112 Enable folding for series of use items by default (by @Stzx)
      You can disable it via Imports option in Settings | Editor | General | Code Folding settings

    • #7112 Support Method bodies option of Settings | Editor | General | Code Folding - General settings to fold function/method bodies by default (by @Stzx)

  • Improve experimental crate-local index:

    • #6801 Add Cargo.toml inspection that checks crate dependency version requirements that do not match any known crate version (by @Kobzol)

    • #6599 Use semantic versioning to improve version sorting in dependency completion

    • #7004 Don’t perform code completion and run inspections if the index is not ready

    Note, the corresponding feature is disabled by default for now. To use it, enable org.rust.crates.local.index experimental feature

  • #7142 Drop support of org.rust.cargo.fetch.out.dir experimental feature. Use org.rust.cargo.evaluate.build.scripts instead if you need to evaluate env!("OUT_DIR") in your include! macro calls

Fixes

  • Name resolution fixes:

    • #7119 Correctly resolve qualified attribute procedural macro paths (like #[foo::bar])

    • #7132 Resolve field shorthand to a local variable in the case of unresolved struct literal

  • Improvements of new name resolution engine:

    • #7089 Correctly resolve macros with absolute paths (like ::foo::bar!())

    • #7057 Exclude some cfg-disabled items from completion

  • Change Signature refactoring (Refactor | Change Signature or Ctrl+F6) fixes:

    • #7081 Fix some false positives in name conflict detection (by @Kobzol)

    • #7080 Do not needlessly import default type arguments (by @Kobzol)

    • #7076 Correctly place function visibility after attributes (by @Kobzol)

  • #7108 Insert correct use item by auto-import feature in the case of a renamed Cargo package

  • #7101 Fix false positive in Needless lifetimes inspection when the lifetime is used in where clause (by @Kobzol)

  • #5491 Add line break after opening brace in struct blocks by built-in formatter (by @Kobzol)

  • #7131 Fix false-positive proofreading warnings for sentences written in several sequential Rust comments. Note, you can enable/disable proofreading in Rust files in Preferences | Editor | Proofreading | Grammar settings

  • #7121 Reload project model automatically when workspace-root Cargo.toml file is changed (and saved). Previously it was work only for package Cargo.toml files

  • #7079 Fix proc macro expansion if proc macro crate is added as separate cargo project in Cargo tool window

  • #7072 Place Show the result of macro expansion intention lower in the intention list

  • #6013 Don’t run some inspections on Rust files outside a valid Cargo project to avoid expected false positive errors

  • #7070 Don’t show errors related to Rust edition if we don’t known the edition (by @Stzx)

  • #7150 Fix Can't find process starter error when running DTrace profiler with CLion 2021.1

  • #6201 Avoid Cargo project duplication in the project model. This fixes some issues related to such duplications

Internal Improvements

  • #7114 Don’t show “Tip of the Day” at startup in internal IDEs (for the plugin developers)

  • #7094 Enable Gradle Build Cache for local builds (see #7094 for more details)

  • #6903 Introduce 2021 edition variant in the plugin and adjust the corresponding code

Full set of changes can be found here