Skip to content

Commit

Permalink
Changelog #198
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Sep 11, 2023
1 parent 0a96e56 commit 9239972
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 18 deletions.
73 changes: 58 additions & 15 deletions generated_assists.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,25 @@ fn main() {
```


[discrete]
=== `bind_unused_param`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/bind_unused_param.rs#L12[bind_unused_param.rs]

Binds unused function parameter to an underscore.

.Before
```rust
fn some_function(x: i32┃) {}
```

.After
```rust
fn some_function(x: i32) {
let _ = x;
}
```


[discrete]
=== `change_visibility`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/change_visibility.rs#L13[change_visibility.rs]
Expand All @@ -332,7 +351,7 @@ pub(crate) fn frobnicate() {}

[discrete]
=== `convert_bool_then_to_if`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_bool_then.rs#L132[convert_bool_then.rs]
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_bool_then.rs#L131[convert_bool_then.rs]

Converts a `bool::then` method call to an equivalent if expression.

Expand Down Expand Up @@ -811,27 +830,13 @@ Move an expression out of a format string.

.Before
```rust
macro_rules! format_args {
($lit:literal $(tt:tt)*) => { 0 },
}
macro_rules! print {
($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
}

fn main() {
print!("{var} {x + 1}┃");
}
```

.After
```rust
macro_rules! format_args {
($lit:literal $(tt:tt)*) => { 0 },
}
macro_rules! print {
($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
}

fn main() {
print!("{var} {}"┃, x + 1);
}
Expand Down Expand Up @@ -2016,6 +2021,44 @@ fn foo() {
```


[discrete]
=== `into_to_qualified_from`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/into_to_qualified_from.rs#L10[into_to_qualified_from.rs]

Convert an `into` method call to a fully qualified `from` call.

.Before
```rust
//- minicore: from
struct B;
impl From<i32> for B {
fn from(a: i32) -> Self {
B
}
}

fn main() -> () {
let a = 3;
let b: B = a.in┃to();
}
```

.After
```rust
struct B;
impl From<i32> for B {
fn from(a: i32) -> Self {
B
}
}

fn main() -> () {
let a = 3;
let b: B = B::from(a);
}
```


[discrete]
=== `introduce_named_generic`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/introduce_named_generic.rs#L8[introduce_named_generic.rs]
Expand Down
10 changes: 8 additions & 2 deletions generated_diagnostic.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ This diagnostic is shown when the derive attribute has invalid input.


=== mismatched-arg-count
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs#L8[mismatched_arg_count.rs]
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs#L35[mismatched_arg_count.rs]

This diagnostic is triggered if a function is invoked with an incorrect amount of arguments.


=== mismatched-tuple-struct-pat-arg-count
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs#L10[mismatched_arg_count.rs]

This diagnostic is triggered if a function is invoked with an incorrect amount of arguments.

Expand Down Expand Up @@ -100,7 +106,7 @@ This diagnostic is triggered on mutating an immutable variable.


=== no-such-field
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-diagnostics/src/handlers/no_such_field.rs#L11[no_such_field.rs]
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-diagnostics/src/handlers/no_such_field.rs#L12[no_such_field.rs]

This diagnostic is triggered if created structure does not have field provided in record.

Expand Down
2 changes: 1 addition & 1 deletion generated_features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ image::https://user-images.githubusercontent.com/48062697/113020658-b5f98b80-917


=== Inlay Hints
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L392[inlay_hints.rs]
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L421[inlay_hints.rs]

rust-analyzer shows additional information inline with the source code.
Editors usually render this using read-only virtual text snippets interspersed with code.
Expand Down
42 changes: 42 additions & 0 deletions thisweek/_posts/2023-09-11-changelog-198.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
= Changelog #198
:sectanchors:
:experimental:
:page-layout: post

Commit: commit:326f37ef1f53575fd38e768065b6bcfcebdce462[] +
Release: release:2023-09-11[] (`v0.3.1657`)

== New Features

* pr:15578[] diagnose mismatched argument count for tuple struct patterns:
+
image::https://user-images.githubusercontent.com/308347/266911785-8ab15830-e25b-4a9d-8a38-15e14f91e4df.png["A screenshot showing an error on `let S(a, b) = todo!()`"]
* pr:15584[] diagnose private fields in record constructor:
+
image::https://user-images.githubusercontent.com/308347/266912247-cd84cb65-0afc-4f4a-a972-edefc932bf2e.png["A screenshot showing an error when using a private field in a pattern"]
* pr:15557[] parse `builtin#` syntax and add type checking for `builtin#offset_of`.
* pr:15559[] implement `builtin#format_args`, using rustc's `format_args` parser.
* pr:15532[] on-type format `(`, by adding closing `)` automatically.
* pr:15573[] add "into to qualified from" assist.
* pr:15524[] add "Bind unused parameter" assist.
* pr:15528[] enable `cfg(rust_analyzer)` when code is being analyzed.

== Fixes

* pr:15574[] use crate name for `CARGO_CRATE_NAME`.
* pr:15577[] clear native diagnostics for closed files.

== Internal Improvements

* pr:15568[] replace `format_args` parser with upstream fork.
* pr:15565[] implement `write_via_move` intrinsic for MIR eval.
* pr:15571[] remove allocation on MIR eval memory write.
* pr:15567[] ignore enum variants in analysis stats of MIR bodies.
* pr:15575[] intern projections in MIR place.
* pr:15430[] de-unwrap `wrap_return_type_in_result`.
* pr:15529[] do not send inlay hint refresh requests on file edits.
* pr:15522[] resolve inlay hint data lazily.
* pr:15586[], pr:15592[] shrink some stuff.
* pr:15564[] use current folder's `rustfmt.toml` with custom configurations.
* pr:15560[] when using `rust-project.json`, prefer the sysroot-defined rustc over discovery in `$PATH`.
* pr:15558[] remove `rust-analyzer.discoverProjectCommand` in favor of a companion VS Code extension.

0 comments on commit 9239972

Please sign in to comment.