From cf15b2a8950d22528445b9d251fad4a4540acaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 19 Apr 2021 09:03:26 +0300 Subject: [PATCH] Changelog #73 --- generated_assists.adoc | 31 ++++++++++++ generated_config.adoc | 6 +++ generated_diagnostic.adoc | 8 +-- generated_features.adoc | 3 +- manual.adoc | 2 +- thisweek/_posts/2021-04-19-changelog-73.adoc | 52 ++++++++++++++++++++ 6 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 thisweek/_posts/2021-04-19-changelog-73.adoc diff --git a/generated_assists.adoc b/generated_assists.adoc index 02feaf42..02279af9 100644 --- a/generated_assists.adoc +++ b/generated_assists.adoc @@ -637,6 +637,37 @@ impl Default for Example { ``` +[discrete] +=== `generate_deref` +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_deref.rs#L15[generate_deref.rs] + +Generate `Deref` impl using the given struct field. + +.Before +```rust +struct A; +struct B { + ┃a: A +} +``` + +.After +```rust +struct A; +struct B { + a: A +} + +impl std::ops::Deref for B { + type Target = A; + + fn deref(&self) -> &Self::Target { + &self.a + } +} +``` + + [discrete] === `generate_derive` **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_derive.rs#L9[generate_derive.rs] diff --git a/generated_config.adoc b/generated_config.adoc index 871c65ad..e0ee35b4 100644 --- a/generated_config.adoc +++ b/generated_config.adoc @@ -39,6 +39,12 @@ List of features to activate. -- Run build scripts (`build.rs`) for more precise code analysis. -- +[[rust-analyzer.cargo.useRustcWrapperForBuildScripts]]rust-analyzer.cargo.useRustcWrapperForBuildScripts (default: `true`):: ++ +-- +Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to +avoid compiling unnecessary things. +-- [[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`):: + -- diff --git a/generated_diagnostic.adoc b/generated_diagnostic.adoc index a06de5c7..74a93b66 100644 --- a/generated_diagnostic.adoc +++ b/generated_diagnostic.adoc @@ -6,7 +6,7 @@ This diagnostic is triggered if the `break` keyword is used outside of a loop. === inactive-code -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L126[diagnostics.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L127[diagnostics.rs] This diagnostic is shown for code with inactive `#[cfg]` attributes. @@ -18,7 +18,7 @@ This diagnostic is triggered if an item name doesn't follow https://doc.rust-lan === macro-error -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L199[diagnostics.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L200[diagnostics.rs] This diagnostic is shown for macro expansion errors. @@ -101,7 +101,7 @@ This diagnostic is triggered when `.filter_map(..).next()` is used, rather than === unlinked-file -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/diagnostics/unlinked_file.rs#L23[unlinked_file.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/diagnostics/unlinked_file.rs#L24[unlinked_file.rs] This diagnostic is shown for files that are not included in any crate, or files that are part of crates rust-analyzer failed to discover. The file will not have IDE features available. @@ -133,7 +133,7 @@ This diagnostic is triggered if rust-analyzer is unable to discover referred mod === unresolved-proc-macro -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L159[diagnostics.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L160[diagnostics.rs] This diagnostic is shown when a procedural macro can not be found. This usually means that procedural macro support is simply disabled (and hence is only a weak hint instead of an error), diff --git a/generated_features.adoc b/generated_features.adoc index 05ea0ef1..66e0967e 100644 --- a/generated_features.adoc +++ b/generated_features.adoc @@ -340,13 +340,14 @@ image::https://user-images.githubusercontent.com/48062697/113065576-04298180-91b === On Enter -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing/on_enter.rs#L15[on_enter.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing/on_enter.rs#L16[on_enter.rs] rust-analyzer can override kbd:[Enter] key to make it smarter: - kbd:[Enter] inside triple-slash comments automatically inserts `///` - kbd:[Enter] in the middle or after a trailing space in `//` inserts `//` - kbd:[Enter] inside `//!` doc comments automatically inserts `//!` +- kbd:[Enter] after `{` indents contents and closing `}` of single-line block This action needs to be assigned to shortcut explicitly. diff --git a/manual.adoc b/manual.adoc index e74b287f..b86e9177 100644 --- a/manual.adoc +++ b/manual.adoc @@ -541,7 +541,7 @@ include::./generated_assists.adoc[] == Diagnostics While most errors and warnings provided by rust-analyzer come from the `cargo check` integration, there's a growing number of diagnostics implemented using rust-analyzer's own analysis. -These diagnostics don't respect `#[allow]` or `#[deny]` attributes yet, but can be turned off using the `rust-analyzer.diagnostics.enable`, `rust-analyzer.diagnostics.enableExperimental` or `rust-analyzer.diagnostics.disabled` settings. +Some of these diagnostics don't respect `\#[allow]` or `\#[deny]` attributes yet, but can be turned off using the `rust-analyzer.diagnostics.enable`, `rust-analyzer.diagnostics.enableExperimental` or `rust-analyzer.diagnostics.disabled` settings. include::./generated_diagnostic.adoc[] diff --git a/thisweek/_posts/2021-04-19-changelog-73.adoc b/thisweek/_posts/2021-04-19-changelog-73.adoc new file mode 100644 index 00000000..2fc45cc8 --- /dev/null +++ b/thisweek/_posts/2021-04-19-changelog-73.adoc @@ -0,0 +1,52 @@ += Changelog #73 +:sectanchors: +:page-layout: post + +Commit: commit:4f94bcd611bd3eb7d845ec1d3909f69ed065699c[] + +Release: release:2021-04-19[] + +== Sponsors + +**Become a sponsor:** On https://opencollective.com/rust-analyzer/[OpenCollective] or +https://github.com/sponsors/rust-analyzer[GitHub Sponsors]. + +== New Features + +* pr:8467[] (first contribution) add "generate `Deref` impl" assist: ++ +image::https://user-images.githubusercontent.com/5489149/115183917-9971b480-a091-11eb-98b0-d847543cde01.gif[] +* pr:8476[] avoid checking the whole project during initial loading. +* pr:8481[], pr:8494[], pr:8498[] improve performance by delaying computation of fixes for diagnostics. +* pr:8354[] distinguish between different operators in semantic highlighting. + +== Fixes + +* pr:8478[] don't spam repeated error messages when `cargo check` fails. +* pr:8496[] exclude `nightly` tag from `git describe` to really fix version string. +* pr:8489[] indent block expressions on enter: ++ +image::https://user-images.githubusercontent.com/1786438/114444123-cb38d600-9bce-11eb-8af2-8e8d1c0f9908.gif[] +* pr:8415[] fix faulty assertion when extracting function with macro call. +* pr:8432[] consider outer scopes' ``#[allow]``s in `decl_check`. +* pr:8526[] do not show flyimports in trait or impl declarations. +* pr:8510[] move cursor position when using item movers. +* pr:8536[] (first contribution) slightly improve status messages. +* pr:8543[] (first contribution) fix "Fill match arms" issue with single-element tuples. +* pr:8545[] fix primitive shadowing with inner items. +* pr:8539[] do not propose inherent traits in flyimports and import assists. +* pr:8546[] return `CallInfo` for unclosed call expressions. +* pr:8550[] handle extended key-value attributes in MBE. +* pr:8560[] (first contribution) correctly escape characters in doc comments when passed through macros. +* pr:8561[] accept `E` notation in doctests. +* pr:8564[] expand `global_asm!` to nothing. +* pr:8569[] support inherent impls in unnamed consts. + +== Internal Improvements + +* pr:8483[] clarify who rls-2.0 wg really is. +* pr:8499[] don't use `#[should_panic]` for tests. +* pr:8500[] fix flakiness of "accidentally quadratic?" test. +* pr:8507[] follow test style guide in `typing.rs`. +* pr:8514[], pr:8515[] add more profiling spans to type inference. +* pr:8549[] fix `TestDB::module_at_position` with submodules. +* pr:8551[] (first contribution) nail down `rowan` version.