Skip to content

Commit aa961ae

Browse files
committed
Changelog #223
1 parent f2d5679 commit aa961ae

File tree

4 files changed

+129
-15
lines changed

4 files changed

+129
-15
lines changed

generated_assists.adoc

+60-2
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,42 @@ fn main() {
848848
```
849849

850850

851+
[discrete]
852+
=== `destructure_struct_binding`
853+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/destructure_struct_binding.rs#L18[destructure_struct_binding.rs]
854+
855+
Destructures a struct binding in place.
856+
857+
.Before
858+
```rust
859+
struct Foo {
860+
bar: i32,
861+
baz: i32,
862+
}
863+
fn main() {
864+
let ┃foo = Foo { bar: 1, baz: 2 };
865+
let bar2 = foo.bar;
866+
let baz2 = &foo.baz;
867+
}
868+
```
869+
870+
.After
871+
```rust
872+
struct Foo {
873+
bar: i32,
874+
baz: i32,
875+
}
876+
fn main() {
877+
let Foo { bar, baz } = Foo { bar: 1, baz: 2 };
878+
let bar2 = bar;
879+
let baz2 = &baz;
880+
}
881+
```
882+
883+
851884
[discrete]
852885
=== `destructure_tuple_binding`
853-
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/destructure_tuple_binding.rs#L15[destructure_tuple_binding.rs]
886+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/destructure_tuple_binding.rs#L18[destructure_tuple_binding.rs]
854887

855888
Destructures a tuple binding in place.
856889

@@ -1071,6 +1104,31 @@ fn main() {
10711104
```
10721105

10731106

1107+
[discrete]
1108+
=== `fill_record_pattern_fields`
1109+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/fill_record_pattern_fields.rs#L8[fill_record_pattern_fields.rs]
1110+
1111+
Fills fields by replacing rest pattern in record patterns.
1112+
1113+
.Before
1114+
```rust
1115+
struct Bar { y: Y, z: Z }
1116+
1117+
fn foo(bar: Bar) {
1118+
let Bar { ..┃ } = bar;
1119+
}
1120+
```
1121+
1122+
.After
1123+
```rust
1124+
struct Bar { y: Y, z: Z }
1125+
1126+
fn foo(bar: Bar) {
1127+
let Bar { y, z } = bar;
1128+
}
1129+
```
1130+
1131+
10741132
[discrete]
10751133
=== `fix_visibility`
10761134
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/fix_visibility.rs#L14[fix_visibility.rs]
@@ -1951,7 +2009,7 @@ impl<T: Clone> ${0:_} for Ctx<T> {}
19512009

19522010
[discrete]
19532011
=== `inline_call`
1954-
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_call.rs#L161[inline_call.rs]
2012+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_call.rs#L164[inline_call.rs]
19552013

19562014
Inlines a function or method body creating a `let` statement per parameter unless the parameter
19572015
can be inlined. The parameter will be inlined either if it the supplied argument is a simple local

generated_config.adoc

+10-10
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ This option does not take effect until rust-analyzer is restarted.
144144
--
145145
Compilation target override (target triple).
146146
--
147+
[[rust-analyzer.cargo.targetDir]]rust-analyzer.cargo.targetDir (default: `null`)::
148+
+
149+
--
150+
Optional path to a rust-analyzer specific target directory.
151+
This prevents rust-analyzer's `cargo check` and initial build-script and proc-macro
152+
building from locking the `Cargo.lock` at the expense of duplicating build artifacts.
153+
154+
Set to `true` to use a subdirectory of the existing target directory or
155+
set to a path relative to the workspace to use that path.
156+
--
147157
[[rust-analyzer.cargo.unsetTest]]rust-analyzer.cargo.unsetTest (default: `["core"]`)::
148158
+
149159
--
@@ -814,16 +824,6 @@ Command to be executed instead of 'cargo' for runnables.
814824
Additional arguments to be passed to cargo for runnables such as
815825
tests or binaries. For example, it may be `--release`.
816826
--
817-
[[rust-analyzer.rust.analyzerTargetDir]]rust-analyzer.rust.analyzerTargetDir (default: `null`)::
818-
+
819-
--
820-
Optional path to a rust-analyzer specific target directory.
821-
This prevents rust-analyzer's `cargo check` from locking the `Cargo.lock`
822-
at the expense of duplicating build artifacts.
823-
824-
Set to `true` to use a subdirectory of the existing target directory or
825-
set to a path relative to the workspace to use that path.
826-
--
827827
[[rust-analyzer.rustc.source]]rust-analyzer.rustc.source (default: `null`)::
828828
+
829829
--

manual.adoc

+16-3
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,14 @@ You can also pass LSP settings to the server:
337337
[source,vim]
338338
----
339339
lua << EOF
340-
local nvim_lsp = require'lspconfig'
340+
local lspconfig = require'lspconfig'
341341
342342
local on_attach = function(client)
343343
require'completion'.on_attach(client)
344344
end
345345
346-
nvim_lsp.rust_analyzer.setup({
347-
on_attach=on_attach,
346+
lspconfig.rust_analyzer.setup({
347+
on_attach = on_attach,
348348
settings = {
349349
["rust-analyzer"] = {
350350
imports = {
@@ -367,6 +367,19 @@ nvim_lsp.rust_analyzer.setup({
367367
EOF
368368
----
369369

370+
If you're running Neovim 0.10 or later, you can enable inlay hints via `on_attach`:
371+
372+
[source,vim]
373+
----
374+
lspconfig.rust_analyzer.setup({
375+
on_attach = function(client, bufnr)
376+
vim.lsp.inlay_hint.enable(bufnr)
377+
end
378+
})
379+
----
380+
381+
Note that the hints are only visible after `rust-analyzer` has finished loading **and** you have to edit the file to trigger a re-render.
382+
370383
See https://sharksforarms.dev/posts/neovim-rust/ for more tips on getting started.
371384

372385
Check out https://github.com/mrcjkb/rustaceanvim for a batteries included rust-analyzer setup for Neovim.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
= Changelog #223
2+
:sectanchors:
3+
:experimental:
4+
:page-layout: post
5+
6+
Commit: commit:037924c4d8961ded7872cbf6f75f5b0349859686[] +
7+
Release: release:2024-03-04[] (`v0.3.1868`)
8+
9+
== New Features
10+
11+
* pr:16638[] (first contribution) add `destructure_struct_binding` assist.
12+
* pr:16651[] add `fill_record_pattern_fields` assist.
13+
* pr:16687[] support tuples in term search.
14+
* pr:16555[], pr:16692[] speed up completions by considering coherence.
15+
16+
== Fixes
17+
18+
* pr:16630[] fix type inference of closures with predicates.
19+
* pr:16679[] resolve modules in blocks in the `ide` layer.
20+
* pr:16647[] fix false positive for `dyn Trait` in `replace_filter_map_next_with_find_map`.
21+
* pr:16678[] fix panic when inlining callsites inside macro parameters.
22+
* pr:16684[] don't panic on synthetic syntax in inference diagnostics.
23+
* pr:16691[] fix completions panicking with certain macro setups.
24+
* pr:16693[] prefer sysroot `rustc` in `rust-project.json` projects.
25+
* pr:16696[], pr:16709[] handle `deref_mut` and `index_mut` in index expressions.
26+
* pr:16727[] don't highlight related associated items of supertraits.
27+
* pr:16702[] ignore generic arguments in intra-doc link path resolution.
28+
* pr:16665[] prioritize `rustup` sysroots over system ones.
29+
* pr:16695[] revert doc-comment highlighting.
30+
31+
== Internal Improvements
32+
33+
* pr:16670[] (first contribution) document NeoVim inlay hint configuration.
34+
* pr:16673[] (first contribution) narrow down `typos` ignore list.
35+
* pr:16706[] drop `load-cargo` dependency on ide.
36+
* pr:16738[] bump `rustc_pattern_analysis`.
37+
* pr:16627[] add repository URL and code sample sections to the bug report template.
38+
* pr:16669[] merge `BorrowKind::Unique` into `BorrowKind::Mut`.
39+
* pr:16697[] add `RelPath::to_path_buf()` method.
40+
* pr:16698[] derive `PartialEq`, `Eq` and `Hash` for `hir::Param`.
41+
* pr:16705[] add public function for resolving callable AST expressions to their HIR equivalents.
42+
* pr:16707[] export `SemanticsImpl` from `hir`.
43+
* pr:16680[] remove `salsa` compile-fail tests.

0 commit comments

Comments
 (0)