IntelliJ Rust Changelog #139
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 likecfg_attr(..., derive(...))
,cfg_attr(..., path="...")
, etc.
- Fairly evaluate unknown
cfg
options tofalse
if there is no custom build script (build.rs
) in the package. Previously, in order to avoid wrongly disabling the actual code, unknowncfg
options and unknown Cargo features were considered enabled and disabled simultaneously. Note, you can turn on the new logic for packages containingbuild.rs
as well by enabling the experimental build script evaluation: just enableorg.rust.cargo.evaluate.build.scripts
inHelp | Find Action | Experimental Features
dialog
- Improve
cfg(test)
processing for external dependencies by providing a new heuristic. Nowcfg(test)
is treated as disabled if there is acfg(not(test))
condition in the project. Previously,test
option was considered enabled and disabled simultaneously, i.e. code undercfg(test)
andcfg(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 acfg(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 dependencygit
links). Now you can open URL specified ingit
,homepage
,repository
, anddocumentation
fields (by @Kobzol)
-
Provide folding for TOML files. Currently, it supports tables, arrays, and custom folding regions (by @Kobzol)
- Highlight string-formatting arguments of
panic!
macro
- 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 viaorg.rust.crates.local.index
option inExperimental Feature
dialog (Help | Find Action
and typeExperimental features
to open the dialog)
Fixes
- New name resolution engine improvements:
- Support
#![macro_use]
attribute at file level
- Consider textual scoping when resolving macros
- 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 inPreferences | Languages & Frameworks | Rust
settings - Support
- Fix name resolution and completion of
Self
keyword for nested structs, enums, andimpl
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 onimpl
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