diff --git a/generated_assists.adoc b/generated_assists.adoc index 1acc25f1..1a08cc8d 100644 --- a/generated_assists.adoc +++ b/generated_assists.adoc @@ -44,7 +44,7 @@ fn main() { [discrete] === `add_impl_default_members` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_missing_impl_members.rs#L55[add_missing_impl_members.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_missing_impl_members.rs#L57[add_missing_impl_members.rs] Adds scaffold for overriding default impl members. @@ -81,7 +81,7 @@ impl Trait for () { [discrete] === `add_impl_missing_members` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_missing_impl_members.rs#L14[add_missing_impl_members.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_missing_impl_members.rs#L16[add_missing_impl_members.rs] Adds scaffold for required impl members. @@ -236,7 +236,7 @@ fn main() { [discrete] === `auto_import` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/auto_import.rs#L66[auto_import.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/auto_import.rs#L68[auto_import.rs] If the name is unresolved, provides all possible imports for it. @@ -276,7 +276,7 @@ pub(crate) fn frobnicate() {} [discrete] === `convert_bool_then_to_if` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_bool_then.rs#L133[convert_bool_then.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_bool_then.rs#L132[convert_bool_then.rs] Converts a `bool::then` method call to an equivalent if expression. @@ -328,7 +328,7 @@ fn main() { [discrete] === `convert_if_to_bool_then` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_bool_then.rs#L21[convert_bool_then.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_bool_then.rs#L20[convert_bool_then.rs] Converts an if expression into a corresponding `bool::then` call. @@ -370,7 +370,7 @@ const _: i32 = 0b1010; [discrete] === `convert_into_to_from` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_into_to_from.rs#L11[convert_into_to_from.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_into_to_from.rs#L8[convert_into_to_from.rs] Converts an Into impl to an equivalent From impl. @@ -583,7 +583,7 @@ fn qux(bar: Bar, baz: Baz) {} [discrete] === `extract_function` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_function.rs#L35[extract_function.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_function.rs#L33[extract_function.rs] Extracts selected statements and comments into new function. @@ -648,7 +648,7 @@ fn bar(name: i32) -> i32 { [discrete] === `extract_struct_from_enum_variant` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs#L28[extract_struct_from_enum_variant.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs#L26[extract_struct_from_enum_variant.rs] Extracts a struct from enum variant. @@ -1120,7 +1120,7 @@ impl Value { [discrete] === `generate_from_impl_for_enum` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs#L7[generate_from_impl_for_enum.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs#L6[generate_from_impl_for_enum.rs] Adds a From impl for an enum variant with one tuple field. @@ -1143,7 +1143,7 @@ impl From for A { [discrete] === `generate_function` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_function.rs#L27[generate_function.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_function.rs#L26[generate_function.rs] Adds a stub function with a signature matching the function under the cursor. @@ -1341,7 +1341,7 @@ impl Person { [discrete] === `inline_call` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L155[inline_call.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L156[inline_call.rs] Inlines a function or method body creating a `let` statement per parameter unless the parameter can be inlined. The parameter will be inlined either if it the supplied argument is a simple local @@ -1367,7 +1367,7 @@ fn foo(name: Option<&str>) { [discrete] === `inline_into_callers` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L23[inline_call.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L24[inline_call.rs] Inline a function or method body into all of its callers where possible, creating a `let` statement per parameter unless the parameter can be inlined. The parameter will be inlined either if it the supplied argument is a simple local @@ -2061,7 +2061,7 @@ fn main() { [discrete] === `replace_derive_with_manual_impl` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs#L23[replace_derive_with_manual_impl.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs#L21[replace_derive_with_manual_impl.rs] Converts a `derive` impl into a manual one. @@ -2439,7 +2439,7 @@ fn foo() { [discrete] === `unwrap_result_return_type` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/unwrap_result_return_type.rs#L10[unwrap_result_return_type.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/unwrap_result_return_type.rs#L13[unwrap_result_return_type.rs] Unwrap the function's return type. @@ -2456,7 +2456,7 @@ fn foo() -> i32 { 42i32 } [discrete] === `wrap_return_type_in_result` -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/wrap_return_type_in_result.rs#L11[wrap_return_type_in_result.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/wrap_return_type_in_result.rs#L14[wrap_return_type_in_result.rs] Wrap the function's return type into Result. diff --git a/generated_diagnostic.adoc b/generated_diagnostic.adoc index 676d72ce..bb5ccd82 100644 --- a/generated_diagnostic.adoc +++ b/generated_diagnostic.adoc @@ -70,7 +70,7 @@ This diagnostic is triggered if `match` block is missing one or more match arms. === missing-ok-or-some-in-tail-expr -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_diagnostics/src/handlers/missing_ok_or_some_in_tail_expr.rs#L8[missing_ok_or_some_in_tail_expr.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_diagnostics/src/handlers/missing_ok_or_some_in_tail_expr.rs#L10[missing_ok_or_some_in_tail_expr.rs] This diagnostic is triggered if a block that should return `Result` returns a value not wrapped in `Ok`, or if a block that should return `Option` returns a value not wrapped in `Some`. diff --git a/generated_features.adoc b/generated_features.adoc index ed884036..d80fa69b 100644 --- a/generated_features.adoc +++ b/generated_features.adoc @@ -10,7 +10,7 @@ image::https://user-images.githubusercontent.com/48062697/113020672-b7c34f00-917 === Auto Import -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/auto_import.rs#L10[auto_import.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/auto_import.rs#L12[auto_import.rs] Using the `auto-import` assist it is possible to insert missing imports for unresolved items. When inserting an import it will do so in a structured manner by keeping imports grouped, @@ -312,7 +312,7 @@ image::https://user-images.githubusercontent.com/48062697/113020657-b560f500-917 === Highlight Related -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/highlight_related.rs#L38[highlight_related.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/highlight_related.rs#L37[highlight_related.rs] Highlights constructs related to the thing under the cursor: - if on an identifier, highlights all references to that identifier in the current file @@ -324,7 +324,7 @@ Note: `?` and `->` do not currently trigger this behavior in the VSCode editor. === Hover -**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/hover.rs#L83[hover.rs] +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/hover.rs#L84[hover.rs] Shows additional information, like the type of an expression or the documentation for a definition when "focusing" code. Focusing is usually hovering with a mouse, but can also be triggered with a shortcut. @@ -486,6 +486,10 @@ rust-analyzer can override kbd:[Enter] key to make it smarter: This action needs to be assigned to shortcut explicitly. +Note that, depending on the other installed extensions, this feature can visibly slow down typing. +Similarly, if rust-analyzer crashes or stops responding, `Enter` might not work. +In that case, you can still press `Shift-Enter` to insert a newline. + VS Code:: Add the following to `keybindings.json`: @@ -671,6 +675,7 @@ lifetime:: Emitted for lifetimes. parameter:: Emitted for non-self function parameters. property:: Emitted for struct and union fields. selfKeyword:: Emitted for the self function parameter and self path-specifier. +selfTypeKeyword:: Emitted for the Self type parameter. toolModule:: Emitted for tool modules. typeParameter:: Emitted for type parameters. unresolvedReference:: Emitted for unresolved references, names that rust-analyzer can't find the definition of. diff --git a/thisweek/_posts/2022-03-07-changelog-119.adoc b/thisweek/_posts/2022-03-07-changelog-119.adoc new file mode 100644 index 00000000..899139f5 --- /dev/null +++ b/thisweek/_posts/2022-03-07-changelog-119.adoc @@ -0,0 +1,68 @@ += Changelog #119 +:sectanchors: +:page-layout: post + +Commit: commit:5fae65dd28b450a437ebc800a410164c3af1d516[] + +Release: release:2022-03-07[] + +== Sponsors + +**Become a sponsor:** On https://opencollective.com/rust-analyzer/[OpenCollective] or +https://github.com/sponsors/rust-analyzer[GitHub Sponsors]. + +== A Message from the Team + +We of the rust-analyzer team never took the opportunity to introduce ourselves, but we want to make an exception because of the current events. + +One of the early rust-analyzer contributors is currently in Kyiv, amidst falling missiles and artillery shells. + +Our friend did not ask for this, did not ask to be liberated or saved by the Russian Army. +Neither did the other countless Ukrainians who are today at risk. +Their fault is having been born in a country which a bully decided shouldn't exist. + +In Ukraine, Putin's army is committing war crimes, while those at home have no idea because independent journalism has been outlawed. + +So please, speak up. +If you have friends or family in Russia, call and tell them what millions of people. +And consider https://mobile.twitter.com/Ukraine/status/1497294840110977024[making a donation] or going to a protest. + +Thank you and _Slava Ukraini!_ + +== Heads-up + +The latest Visual Studio Code version (1.65, released on March 3) has native support for inlay hints. +We have been using a custom implementation of that, but would like to switch to the upstream one in pr:11445[], planned to be merged next week. +This means that the next release will require VS Code 1.65. + +Unfortunately, the upstream implementation brings some regressions. +Specifically, the caret behaves differently when passing over the hint, and the styling is not necessarily better. +In addition, Code only updates the hints about four times per second while typing, causing them to feel more sluggish. + +== New Features + +* pr:11620[] support locals with multiple declaration sites: ++ +image::https://user-images.githubusercontent.com/3757771/156833306-6bdb97ae-1fb3-4fd0-9f7d-1783c54c23a5.gif[] +* pr:11598[] parse destructuring assignments. + +== Fixes + +* pr:11609[] add another case to the syntax fixup code. +* pr:11140[] preserve order of generic args. +* pr:11616[] fix semantic highlighting breaking for lifetimes in macros. +* pr:11595[] lower string literal values. +* pr:11622[] show variadic args in hover function signature. +* pr:11623[] add type variable table to `InferenceTableSnapshot`. +* pr:11629[] fix macro-calls expanding to items in `if`/`while` conditions. +* pr:11630[] recognize `Self` as a proper keyword. +* pr:11613[] add `abort` to safe intrinsics list. + +== Internal Improvements + +* pr:11593[] build release binaries on Ubuntu 18.04. +* pr:11610[] add currently failing test for #11242. +* pr:11574[] slightly refactor `TextEdit`. +* pr:11631[] refactor `syntax_highlighting`. +* pr:11632[] bring back syntax highlighting in test data. +* pr:11639[] re-arrange `ide_db` modules. +* pr:11633[] automatically change text color in logo based on dark mode.