Skip to content

Changelog #70 #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions generated_assists.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl Trait<u32> for () {

[discrete]
=== `add_lifetime_to_type`
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_lifetime_to_type.rs#L6[add_lifetime_to_type.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_lifetime_to_type.rs#L5[add_lifetime_to_type.rs]

Adds a new lifetime to a struct, enum or union.

Expand Down Expand Up @@ -1090,7 +1090,7 @@ fn main() {

[discrete]
=== `merge_imports`
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/merge_imports.rs#L13[merge_imports.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/merge_imports.rs#L10[merge_imports.rs]

Merges two imports with a common prefix.

Expand Down Expand Up @@ -1384,7 +1384,7 @@ fn main() {

[discrete]
=== `reorder_fields`
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/reorder_fields.rs#L10[reorder_fields.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/reorder_fields.rs#L7[reorder_fields.rs]

Reorder the fields of record literals and record patterns in the same order as in
the definition.
Expand Down
4 changes: 2 additions & 2 deletions generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ Use markdown syntax for links in hover.
--
Whether to show inlay type hints for method chains.
--
[[rust-analyzer.inlayHints.maxLength]]rust-analyzer.inlayHints.maxLength (default: `null`)::
[[rust-analyzer.inlayHints.maxLength]]rust-analyzer.inlayHints.maxLength (default: `25`)::
+
--
Maximum length for inlay hints. Default is unlimited.
Maximum length for inlay hints. Set to null to have an unlimited length.
--
[[rust-analyzer.inlayHints.parameterHints]]rust-analyzer.inlayHints.parameterHints (default: `true`)::
+
Expand Down
7 changes: 7 additions & 0 deletions generated_diagnostic.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ This diagnostic is triggered if created structure does not have field provided i
This diagnostic is triggered when `.filter_map(..).next()` is used, rather than the more concise `.find_map(..)`.


=== unlinked-file
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/diagnostics/unlinked_file.rs#L23[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.


=== unresolved-extern-crate
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L43[diagnostics.rs]

Expand Down
23 changes: 18 additions & 5 deletions generated_features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The following postfix snippets are available:


=== Go to Definition
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_definition.rs#L19[goto_definition.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_definition.rs#L15[goto_definition.rs]

Navigates to the definition of an identifier.

Expand Down Expand Up @@ -173,7 +173,7 @@ Navigates to the type of an identifier.


=== Hover
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/hover.rs#L78[hover.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/hover.rs#L81[hover.rs]

Shows additional information, like type of an expression or documentation for definition when "focusing" code.
Focusing is usually hovering with a mouse, but can also be triggered with a shortcut.
Expand Down Expand Up @@ -293,6 +293,19 @@ Clears rust-analyzer's internal database and prints memory usage statistics.
|===


=== Move Item
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/move_item.rs#L16[move_item.rs]

Move item under cursor or selection up and down.

|===
| Editor | Action Name

| VS Code | **Rust Analyzer: Move item up**
| VS Code | **Rust Analyzer: Move item down**
|===


=== On Enter
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing/on_enter.rs#L15[on_enter.rs]

Expand Down Expand Up @@ -346,7 +359,7 @@ Navigates to the parent module of the current module.


=== Related Tests
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L131[runnables.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L127[runnables.rs]

Provides a sneak peek of all tests where the current item is used.

Expand All @@ -362,7 +375,7 @@ The simplest way to use this feature is via the context menu:


=== Rename
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/references/rename.rs#L61[rename.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/references/rename.rs#L64[rename.rs]

Renames the item below the cursor and all of its references

Expand All @@ -374,7 +387,7 @@ Renames the item below the cursor and all of its references


=== Run
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L94[runnables.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L90[runnables.rs]

Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
location**. Super useful for repeatedly running just a single test. Do bind this
Expand Down
25 changes: 24 additions & 1 deletion manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ $ cargo xtask install --server
If your editor can't find the binary even though the binary is on your `$PATH`, the likely explanation is that it doesn't see the same `$PATH` as the shell, see https://github.com/rust-analyzer/rust-analyzer/issues/1811[this issue].
On Unix, running the editor from a shell or changing the `.desktop` file to set the environment should help.

==== `rustup`

`rust-analyzer` is available in `rustup`, but only in the nightly toolchain:

[source,bash]
---
$ rustup +nightly component add rust-analyzer-preview
---

==== Arch Linux

The `rust-analyzer` binary can be installed from the repos or AUR (Arch User Repository):
Expand Down Expand Up @@ -480,7 +489,7 @@ interface Crate {
include_dirs: string[],
exclude_dirs: string[],
},
/// The set of cfgs activated for a given crate, like `["unix", "feature=foo", "feature=bar"]`.
/// The set of cfgs activated for a given crate, like `["unix", "feature=\"foo\"", "feature=\"bar\""]`.
cfg: string[];
/// Target triple for this Crate.
///
Expand Down Expand Up @@ -516,6 +525,20 @@ See https://github.com/rust-analyzer/rust-project.json-example for a small examp

You can set `RA_LOG` environmental variable to `rust_analyzer=info` to inspect how rust-analyzer handles config and project loading.

== Security

At the moment, rust-analyzer assumes that all code is trusted.
Here is a **non-exhaustive** list of ways to make rust-analyzer execute arbitrary code:

* proc macros and build scripts are executed by default
* `.cargo/config` can override `rustc` with an arbitrary executable
* VS Code plugin reads configuration from project directory, and that can be used to override paths to various executables, like `rustfmt` or `rust-analyzer` itself.
* rust-analyzer's syntax trees library uses a lot of `unsafe` and hasn't been properly audited for memory safety.

rust-analyzer itself doesn't access the network.
The VS Code plugin doesn't access the network unless the nightly channel is selected in the settings.
In that case, the plugin uses the GitHub API to check for and download updates.

== Features

include::./generated_features.adoc[]
Expand Down
70 changes: 70 additions & 0 deletions thisweek/_posts/2021-03-29-changelog-70.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
= Changelog #70
:sectanchors:
:page-layout: post

Commit: commit:01dc53a31c39fe754c7228646c456325e49e8d09[] +
Release: release:2021-03-29[]

== Sponsors

**Become a sponsor:** On https://opencollective.com/rust-analyzer/[OpenCollective] or
https://github.com/sponsors/rust-analyzer[GitHub Sponsors].

== New Features

* pr:8054[] add Move item commands (LSP extension):
+
image::https://user-images.githubusercontent.com/308347/112793739-7e052200-906e-11eb-9ed4-1b396ef7d6dc.gif[]

+
image::https://user-images.githubusercontent.com/308347/112793747-83626c80-906e-11eb-9a96-a075e8d38d6e.gif[]

* pr:8178[] show item info when hovering intra-doc links:
+
image::https://user-images.githubusercontent.com/3757771/112197618-91e2fb00-8c0c-11eb-9edc-a7923214d2b6.gif[]

* pr:8056[] on completion, take into account whether types unify:
+
image::https://user-images.githubusercontent.com/22216761/111338556-46d94e80-8634-11eb-9936-2b20eb9e6756.png[]

+
image::https://user-images.githubusercontent.com/22216761/111338598-4e005c80-8634-11eb-92e0-69c2c1cda6fc.png[]

* pr:8212[] implement basic macros 2.0 support:
+
image::https://user-images.githubusercontent.com/11014119/112712565-6eb99380-8f0b-11eb-88de-5d7f974dfe6d.png[]

== Fixes

* pr:8156[] correctly lower `TraitRef`s with default params.
* pr:8144[] (first contribution) fix crash when trying to display closure types.
* pr:8142[] hide incorrect ref match completions for struct fields/methods.
* pr:8138[] set up a search scope when searching for MBE macro references.
* pr:8159[] try to ignore proc-macro stdout to prevent IPC crashes.
* pr:8182[] trim down IPC JSON size.
* pr:8177[] limit hints size by default.
* pr:8183[] fix spurious "Missing command" lenses on macros.
* pr:8168[] fix "Convert to guarded return" for mutable bindings.
* pr:8189[] document `unlinked-file` diagnostic.
* pr:7907[] take visibility into account for autoderef.
* pr:8194[] finally fix version string display in release binaries.
* pr:8206[] ignore main functions outside of the root module.
* pr:8201[] fix recursive macro statements expansion.
* pr:8213[] include const generic in `impl` generation.
* pr:8214[] mention the `rustup` component in the installation instructions.
* pr:8221[] prefer adding `mod` declaration to `lib.rs` over `file.rs` in `unlinked-file` fix.
* pr:8141[] don't suggest long looping paths for imports.
* pr:8155[] fix confusion between functions and parameters.
* pr:8191[], pr:8209[] fix slight memory leak in syntax.

== Internal Improvements

* pr:8136[], pr:8190[] introduce `QuantifiedWhereClause` and `DynTy` analogous to Chalk.
* pr:8139[] align `Canonical` and `InEnvironment` with the Chalk versions.
* pr:8154[] rewrite "Merge use trees" assist using mutable syntax trees.
* pr:8165[] tweak assist API to fit mutable syntax trees.
* pr:8169[] make more use of the HIR in `rename::rename_to_self`.
* pr:8170[] merge bang-macros and derives in name resolution.
* pr:8187[] sweep the new `TraitEnvironmentQuery`.
* pr:8145[] document our security stance.
* pr:8146[] document patch policy.