]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoBump default CHALK_SOLVER_MAX_SIZE to 150
Laurențiu Nicola [Mon, 20 Dec 2021 18:35:45 +0000 (20:35 +0200)]
Bump default CHALK_SOLVER_MAX_SIZE to 150

2 years agoMerge #11060
bors[bot] [Sun, 19 Dec 2021 17:02:40 +0000 (17:02 +0000)]
Merge #11060

11060: minor: Bump deps r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump object
Laurențiu Nicola [Sun, 19 Dec 2021 17:00:42 +0000 (19:00 +0200)]
Bump object

2 years agoBump chalk
Laurențiu Nicola [Sun, 19 Dec 2021 16:58:39 +0000 (18:58 +0200)]
Bump chalk

2 years agoBump deps
Laurențiu Nicola [Sun, 19 Dec 2021 16:44:18 +0000 (18:44 +0200)]
Bump deps

2 years agoMerge #11054
bors[bot] [Sun, 19 Dec 2021 00:17:01 +0000 (00:17 +0000)]
Merge #11054

11054: fix #11049 by removing double trimming r=Veykril a=Heinenen

The `unwrap_trivial_block()` removes the braces around trivial blocks (as the name suggests). This violates the precondition of `update_expr_string()` which removes the first and the last non-whitespace character and thus expects braces to still exist around all blocks.

Co-authored-by: ucrhh <ucrrh@sutdent.kit.edu>
2 years agofix unwrap_block by removing double trimming
ucrhh [Sat, 18 Dec 2021 22:19:53 +0000 (23:19 +0100)]
fix unwrap_block by removing double trimming

2 years agoMerge #11053
bors[bot] [Sat, 18 Dec 2021 21:16:19 +0000 (21:16 +0000)]
Merge #11053

11053: feat: Publish platform-specific Code VSIXes r=me a=lnicola

Closes #10483
CC #10371

Some notes:

 - we still build a plain VSIX, just in case
 - we build the extension on every platform to make the release workflow arguably cleaner
 - the Windows VSIX includes the PDB (but let's leave  #10371 open until we change the Windows stand-alone release to a ZIP file)
 - `npm` doesn't run if started from `xtask`, possibly something related to path mapping; I moved the `npm` calls outside, but..
 - the `Patch` thingy doesn't work any more, so you'll end up with a dirty `package.json` of you run `cargo xtask --client-patch-version`; I don't think we should block on this
 - there's an untested Alpine build; for better or worse, we special-case `musl` distros as `alpine`
 - I tested this as much as I could, but not the publishing and nightly updates
 - you can find some sample artifacts under https://github.com/lnicola/rust-analyzer/releases
 - we can now run the server from the install location (is Code planning to switch to compressed extensions?), except on NixOS
 - Code lets you install a VSIX for the wrong platform (with the results one would expect)
 - I don't know what happens if we try to publish a VSIX without a target

This is a relatively risky, but we'll probably have to take our chances with it.

r? `@rust-analyzer/review`

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoPublish platform-specific Code VSIXes
Laurențiu Nicola [Fri, 17 Dec 2021 18:59:02 +0000 (20:59 +0200)]
Publish platform-specific Code VSIXes

2 years agoMerge #11042
bors[bot] [Sat, 18 Dec 2021 20:21:29 +0000 (20:21 +0000)]
Merge #11042

11042: minor: clarify RA_LOG env var troubleshooting r=lnicola a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/pull/10261

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoFix typo
Lukas Wirth [Sat, 18 Dec 2021 20:02:03 +0000 (21:02 +0100)]
Fix typo

2 years agoMerge #11047
bors[bot] [Sat, 18 Dec 2021 18:32:20 +0000 (18:32 +0000)]
Merge #11047

11047: internal: Prepare Code extension for bundling r=lnicola a=lnicola

CC #10483

This is slightly ugly, but we'll be able to clean it up after ripping the download parts (unless we decide to temporarily drop support for the nightlies).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #11035
bors[bot] [Sat, 18 Dec 2021 17:59:29 +0000 (17:59 +0000)]
Merge #11035

11035: Include clippy lint groups in autocomplete r=Veykril a=k-nasa

## Why

close: https://github.com/rust-analyzer/rust-analyzer/issues/11027

## Proof

I confirmed that complement candidates are coming out.

https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov

Co-authored-by: k-nasa <htilcs1115@gmail.com>
2 years agoMerge #11050
bors[bot] [Sat, 18 Dec 2021 17:03:28 +0000 (17:03 +0000)]
Merge #11050

11050: feat: treat fn keyword inside function pointer type as primitive r=Veykril a=rainy-me

close #11036

Co-authored-by: rainy-me <github@yue.coffee>
2 years agofeat: treat fn keyword inside function pointer type as primitive
rainy-me [Sat, 18 Dec 2021 16:51:51 +0000 (01:51 +0900)]
feat: treat fn keyword inside function pointer type as primitive

2 years agoPrepare Code extension for bundling
Laurențiu Nicola [Sat, 18 Dec 2021 15:38:01 +0000 (17:38 +0200)]
Prepare Code extension for bundling

2 years agoMerge #11046
bors[bot] [Sat, 18 Dec 2021 14:37:58 +0000 (14:37 +0000)]
Merge #11046

11046: internal: move all the lexing to the parser crate r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoUpdate crates/parser/src/lexed_str.rs
Aleksey Kladov [Sat, 18 Dec 2021 14:34:55 +0000 (17:34 +0300)]
Update crates/parser/src/lexed_str.rs

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2 years agointernal: move all the lexing to the parser crate
Aleksey Kladov [Sat, 18 Dec 2021 14:20:38 +0000 (17:20 +0300)]
internal: move all the lexing to the parser crate

2 years agorefactor: chain iter
k-nasa [Sat, 18 Dec 2021 14:19:29 +0000 (23:19 +0900)]
refactor: chain iter

2 years agoconverting lexed str to tokens
Aleksey Kladov [Sat, 18 Dec 2021 12:36:21 +0000 (15:36 +0300)]
converting lexed str to tokens

2 years agosoa all the things
Aleksey Kladov [Sat, 18 Dec 2021 12:31:50 +0000 (15:31 +0300)]
soa all the things

2 years agomove tests
Aleksey Kladov [Sun, 12 Dec 2021 18:35:22 +0000 (21:35 +0300)]
move tests

2 years agomove lexing to the parser crate
Aleksey Kladov [Sun, 12 Dec 2021 18:32:58 +0000 (21:32 +0300)]
move lexing to the parser crate

2 years agominor: dead code
Aleksey Kladov [Sun, 12 Dec 2021 17:41:04 +0000 (20:41 +0300)]
minor: dead code

2 years agoMerge #11043
bors[bot] [Fri, 17 Dec 2021 17:46:42 +0000 (17:46 +0000)]
Merge #11043

11043: fix: fix incorrect mismatched argument count diagnostic with `std::arch` functions r=jonas-schievink a=jonas-schievink

Adds basic support for `#[rustc_legacy_const_generics]`.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10009

Full support would involve actually checking call arguments against the right expected types.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoInitial support for `#[rustc_legacy_const_generics]`
Jonas Schievink [Fri, 17 Dec 2021 17:39:51 +0000 (18:39 +0100)]
Initial support for `#[rustc_legacy_const_generics]`

2 years agominor: clarify RA_LOG env var troubleshooting
Lukas Wirth [Fri, 17 Dec 2021 17:07:01 +0000 (18:07 +0100)]
minor: clarify RA_LOG env var troubleshooting

2 years agoMerge #11041
bors[bot] [Fri, 17 Dec 2021 15:52:53 +0000 (15:52 +0000)]
Merge #11041

11041: minor: Fix some clippy lints r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoFix some clippy lints
Laurențiu Nicola [Fri, 17 Dec 2021 15:46:20 +0000 (17:46 +0200)]
Fix some clippy lints

2 years agoMerge #10527
bors[bot] [Fri, 17 Dec 2021 15:44:48 +0000 (15:44 +0000)]
Merge #10527

10527: internal: Remove a few snippet completions, replace them with user snippets definitions in VSCode r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9636
cc https://github.com/rust-analyzer/rust-analyzer/issues/7033#issuecomment-939959905

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUpdate tests
Lukas Wirth [Tue, 12 Oct 2021 11:12:52 +0000 (13:12 +0200)]
Update tests

2 years agoRemove needless clones
Laurențiu Nicola [Fri, 17 Dec 2021 15:35:10 +0000 (17:35 +0200)]
Remove needless clones

2 years agoSpelling nits
Laurențiu Nicola [Fri, 17 Dec 2021 15:26:35 +0000 (17:26 +0200)]
Spelling nits

2 years agoAdd a few default snippets for VSCode
Lukas Wirth [Tue, 12 Oct 2021 10:14:24 +0000 (12:14 +0200)]
Add a few default snippets for VSCode

2 years agoMerge #11040
bors[bot] [Fri, 17 Dec 2021 14:23:45 +0000 (14:23 +0000)]
Merge #11040

11040: fix: Don't duplicate attribute completions r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11012
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Don't duplicate attribute completions
Lukas Wirth [Fri, 17 Dec 2021 14:22:53 +0000 (15:22 +0100)]
fix: Don't duplicate attribute completions

2 years agomanual run sourcegen_lint_completions
k-nasa [Thu, 16 Dec 2021 23:46:17 +0000 (08:46 +0900)]
manual run sourcegen_lint_completions

2 years agoAdd clippy lint group to attribute auto compleme
k-nasa [Thu, 16 Dec 2021 23:34:08 +0000 (08:34 +0900)]
Add clippy lint group to attribute auto compleme

2 years agoList struct to clonable
k-nasa [Thu, 16 Dec 2021 23:33:46 +0000 (08:33 +0900)]
List struct to clonable

2 years agoMerge #11030
bors[bot] [Thu, 16 Dec 2021 13:26:16 +0000 (13:26 +0000)]
Merge #11030

11030: Add comma for "move if to guard" r=Veykril a=weirane

As I mentioned in #11017, there is a little issue in the implementation for if branch. This code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the false. I moved the fix from the code handling else branch to above.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2 years agoMerge #11031
bors[bot] [Thu, 16 Dec 2021 06:36:10 +0000 (06:36 +0000)]
Merge #11031

11031: minor: Set `MACOSX_DEPLOYMENT_TARGET` to 10.15 to improve compat r=lnicola a=lnicola

Since GitHub (and also us, explicitly) switched the `macos-latest` runners to 11, let's try to bring back support for 10.15.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoSet MACOSX_DEPLOYMENT_TARGET to 10.15 to improve compat
Laurențiu Nicola [Thu, 16 Dec 2021 06:02:09 +0000 (08:02 +0200)]
Set MACOSX_DEPLOYMENT_TARGET to 10.15 to improve compat

2 years agoAdd comma for "move if to guard"
Wang Ruochen [Wed, 15 Dec 2021 23:26:24 +0000 (15:26 -0800)]
Add comma for "move if to guard"

2 years agoMerge #11017
bors[bot] [Wed, 15 Dec 2021 23:04:51 +0000 (23:04 +0000)]
Merge #11017

11017: Support "move if to guard" with an else branch r=Veykril a=weirane

Support the assist `move_arm_cond_to_match_guard` when there is an else branch.

I have two questions:
1. How to indent the first line of a match arm? `matcharm.indent()` doesn't seem to work. so I hard coded four spaces here:
https://github.com/weirane/rust-analyzer/blob/95a0de85d5d659e876e731725475f1c022719f31/crates/ide_assists/src/handlers/move_guard.rs#L162-L163

2. I find a little issue in the original implementation, this code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the `false`. Should I also fix that? Or this can go in a separate PR.

Closes #10997.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2 years agoAdd coverage marks
Wang Ruochen [Wed, 15 Dec 2021 22:44:47 +0000 (14:44 -0800)]
Add coverage marks

2 years agoMerge #11029
bors[bot] [Wed, 15 Dec 2021 22:00:51 +0000 (22:00 +0000)]
Merge #11029

11029: internal: Refactor release workflow to reduce duplication r=lnicola a=lnicola

This reduces duplication by using `matrix` and paves the way for https://github.com/rust-analyzer/rust-analyzer/issues/10483. The `musl` builder is unchanged because it uses a container.

~~We also get rid of the MacOS 11 SDK thing, which is from when most MacOS builders were on 10.~~ Or not, the default is still 10.15.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoRefactor release workflow
Laurențiu Nicola [Wed, 15 Dec 2021 20:16:41 +0000 (22:16 +0200)]
Refactor release workflow

2 years agoMerge #11023
bors[bot] [Wed, 15 Dec 2021 12:45:13 +0000 (12:45 +0000)]
Merge #11023

11023: minor: Really switch XCode version r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoReally switch XCode version
Laurențiu Nicola [Wed, 15 Dec 2021 12:42:39 +0000 (14:42 +0200)]
Really switch XCode version

2 years agoMerge #11022
bors[bot] [Wed, 15 Dec 2021 11:54:57 +0000 (11:54 +0000)]
Merge #11022

11022: minor: Enable workflow_dispatch for release workflow r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoEnable workflow_dispatch for release workflow
Laurențiu Nicola [Wed, 15 Dec 2021 11:54:06 +0000 (13:54 +0200)]
Enable workflow_dispatch for release workflow

2 years agoMerge #11021
bors[bot] [Wed, 15 Dec 2021 11:37:06 +0000 (11:37 +0000)]
Merge #11021

11021: internal: Use default XCode version r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoUse default XCode version
Laurențiu Nicola [Wed, 15 Dec 2021 11:34:20 +0000 (13:34 +0200)]
Use default XCode version

2 years agoSupport "move if to guard" with an else branch
Wang Ruochen [Tue, 14 Dec 2021 18:27:44 +0000 (10:27 -0800)]
Support "move if to guard" with an else branch

2 years agoMerge #11011
bors[bot] [Tue, 14 Dec 2021 11:56:30 +0000 (11:56 +0000)]
Merge #11011

11011: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years ago`match_ast!` takes a pattern to allow underscore usage
Lukas Wirth [Tue, 14 Dec 2021 11:44:31 +0000 (12:44 +0100)]
`match_ast!` takes a pattern to allow underscore usage

2 years agoSimplify
Lukas Wirth [Tue, 14 Dec 2021 11:38:20 +0000 (12:38 +0100)]
Simplify

2 years agoMerge #11009
bors[bot] [Tue, 14 Dec 2021 11:11:29 +0000 (11:11 +0000)]
Merge #11009

11009: internal: Move out doc-links tests into a separate module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMove out doc-links tests into a separate module
Lukas Wirth [Tue, 14 Dec 2021 11:01:15 +0000 (12:01 +0100)]
Move out doc-links tests into a separate module

2 years agoMerge #11004
bors[bot] [Tue, 14 Dec 2021 09:15:19 +0000 (09:15 +0000)]
Merge #11004

11004: Fix: Infer associated method in local scope r=flodiebold a=XFFXFF

fixes #10936

Co-authored-by: zhoufan <1247714429@qq.com>
2 years agofixes broken tests
zhoufan [Tue, 14 Dec 2021 07:57:58 +0000 (15:57 +0800)]
fixes broken tests

2 years agoinfer associated method in local scope
zhoufan [Tue, 14 Dec 2021 07:34:57 +0000 (15:34 +0800)]
infer associated method in local scope

2 years agoMerge #10998
bors[bot] [Mon, 13 Dec 2021 18:49:06 +0000 (18:49 +0000)]
Merge #10998

10998: Add number representation assists r=Veykril a=errx

Reimplemented assists from this PR https://github.com/rust-analyzer/rust-analyzer/pull/3683 with current APIs.
![image](https://user-images.githubusercontent.com/462486/145726792-47700215-26f2-4fdc-9520-63d1487901e5.png)
![image](https://user-images.githubusercontent.com/462486/145726802-f528a2f7-9159-41d3-b459-fc3fae033e60.png)

I've decided not to add options about size of the groups so behaviour is similar to clippy's.
Minimal number length is also taken from clippy.

Co-authored-by: Oleg Matrokhin <matrokhin@gmail.com>
2 years agoReuse results from split_into_parts()
Oleg Matrokhin [Mon, 13 Dec 2021 18:16:04 +0000 (21:16 +0300)]
Reuse results from split_into_parts()

2 years agoAdd number representation assists
Oleg Matrokhin [Sun, 12 Dec 2021 18:00:40 +0000 (21:00 +0300)]
Add number representation assists

2 years agoMerge #11002
bors[bot] [Mon, 13 Dec 2021 16:17:14 +0000 (16:17 +0000)]
Merge #11002

11002: fix: Add support for v6 macro metadata format r=lnicola a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/issues/10894#issuecomment-991993824

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoAdd support for v6 macro metadata format
Laurențiu Nicola [Mon, 13 Dec 2021 16:13:08 +0000 (18:13 +0200)]
Add support for v6 macro metadata format

2 years agoMerge #11001
bors[bot] [Mon, 13 Dec 2021 15:51:54 +0000 (15:51 +0000)]
Merge #11001

11001: minor: fixup generate assist priorities r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10996
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11000
bors[bot] [Mon, 13 Dec 2021 15:43:12 +0000 (15:43 +0000)]
Merge #11000

11000: fix: insert whitespaces into assoc items for assist when macro generated r=Veykril a=Veykril

This is obviously only a temporary hack which still produces ugly looking items, but as long as the syntax is valid one can at least have rustfmt fix the formatting again.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6588
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: fixup generate assist priorities
Lukas Wirth [Mon, 13 Dec 2021 15:32:57 +0000 (16:32 +0100)]
minor: fixup generate assist priorities

2 years agofix: insert whitespaces into assoc items for assist when macro generated
Lukas Wirth [Mon, 13 Dec 2021 15:25:54 +0000 (16:25 +0100)]
fix: insert whitespaces into assoc items for assist when macro generated

2 years agoMove ws insert rendering for macro expansion into ide_db
Lukas Wirth [Mon, 13 Dec 2021 14:55:13 +0000 (15:55 +0100)]
Move ws insert rendering for macro expansion into ide_db

2 years agoMerge #10995
bors[bot] [Sun, 12 Dec 2021 16:38:56 +0000 (16:38 +0000)]
Merge #10995

10995: internal: switch from trait-based TokenSource to simple struct of arrays r=matklad a=matklad

cc #10765

The idea here is to try to simplify the interface as best as we can. The original trait-based approach is a bit over-engineered and hard to debug. Here, we replace callback with just data. The next PR in series will replace the output `TreeSink` trait with data as well.

The biggest drawback here is that we now require to materialize all parser's input up-front. This is a bad fit for macro by example: when you parse `$e:expr`, you might consume only part of the input. However, today's trait-based solution doesn't really help -- we were already materializing the whole thing! So, let's keep it simple!

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoprettyfy
Aleksey Kladov [Sun, 12 Dec 2021 16:36:14 +0000 (19:36 +0300)]
prettyfy

2 years agoconsistency
Aleksey Kladov [Sun, 12 Dec 2021 16:32:04 +0000 (19:32 +0300)]
consistency

2 years agosimplify
Aleksey Kladov [Sun, 12 Dec 2021 16:31:32 +0000 (19:31 +0300)]
simplify

2 years agotighten up invariants
Aleksey Kladov [Sun, 12 Dec 2021 16:22:37 +0000 (19:22 +0300)]
tighten up invariants

2 years agoadd cross-crate inlines
Aleksey Kladov [Sun, 12 Dec 2021 16:17:04 +0000 (19:17 +0300)]
add cross-crate inlines

2 years agoport mbe to soa tokens
Aleksey Kladov [Sun, 12 Dec 2021 16:06:40 +0000 (19:06 +0300)]
port mbe to soa tokens

2 years agomore orthogonal interface
Aleksey Kladov [Sun, 12 Dec 2021 15:38:49 +0000 (18:38 +0300)]
more orthogonal interface

2 years agoparser tests work
Aleksey Kladov [Sun, 12 Dec 2021 14:58:45 +0000 (17:58 +0300)]
parser tests work

2 years agoSwitch parser to use tokens
Aleksey Kladov [Sun, 14 Nov 2021 19:13:44 +0000 (22:13 +0300)]
Switch parser to use tokens

2 years agouse eof token pattenr
Aleksey Kladov [Sun, 14 Nov 2021 18:37:10 +0000 (21:37 +0300)]
use eof token pattenr

2 years agostart SOA parser interface
Aleksey Kladov [Sun, 14 Nov 2021 13:47:13 +0000 (16:47 +0300)]
start SOA parser interface

2 years agoMerge #10993
bors[bot] [Sun, 12 Dec 2021 11:11:50 +0000 (11:11 +0000)]
Merge #10993

10993: minor: Bump deps r=lnicola a=lnicola

Gets `coutme 2.0`.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump deps
Laurențiu Nicola [Sat, 11 Dec 2021 16:39:23 +0000 (18:39 +0200)]
Bump deps

2 years agoMerge #10951
bors[bot] [Sat, 11 Dec 2021 22:58:49 +0000 (22:58 +0000)]
Merge #10951

10951: feat: assist to generate documentation templates r=Veykril a=numero-744

Closes #10878, #1915 and #4767

Full description is in #10878, better read [the tests](https://github.com/rust-analyzer/rust-analyzer/pull/10951/files#diff-7a64e2efb66b2625443340fcbc96d531baff12c17cc0aaf51885ea94f67de254R424) to understand what this feature does.

- [x] There is one remaining thing about non-`pub` functions, what do you think about it?
- [x] In this PR [empty examples are generated](https://github.com/rust-analyzer/rust-analyzer/pull/10951/files#diff-7a64e2efb66b2625443340fcbc96d531baff12c17cc0aaf51885ea94f67de254R99) for `trait` functions, but maybe no examples should be provided at all.
- [x] If there is already a documentation, add another one with a separator ([currently done](https://github.com/rust-analyzer/rust-analyzer/pull/10951/files#diff-7a64e2efb66b2625443340fcbc96d531baff12c17cc0aaf51885ea94f67de254R74)) or simply disable this assist?
- [x] I will check once more that the generated examples are correct (ie. they are easy to fill before that they are built and tested)

Comments appreciated :smile:

Co-authored-by: Côme ALLART <come.allart@etu.emse.fr>
2 years agofeat: remove should_panic example generation
Côme ALLART [Sat, 11 Dec 2021 21:46:54 +0000 (22:46 +0100)]
feat: remove should_panic example generation

2 years agorefactor: use hir to test if a value is returned
Côme ALLART [Sat, 11 Dec 2021 19:52:14 +0000 (20:52 +0100)]
refactor: use hir to test if a value is returned

2 years agorefactor: use Itertools::intersperse
Côme ALLART [Sat, 11 Dec 2021 19:41:23 +0000 (20:41 +0100)]
refactor: use Itertools::intersperse

2 years agorefactor: use hir to compare returned and self types
Côme ALLART [Sat, 11 Dec 2021 19:33:08 +0000 (20:33 +0100)]
refactor: use hir to compare returned and self types

2 years agoMerge #10988
bors[bot] [Sat, 11 Dec 2021 17:51:02 +0000 (17:51 +0000)]
Merge #10988

10988: Fix expected type calculation in struct literal if followed by comma r=flodiebold a=flodiebold

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix expected type calculation in struct literal if followed by comma
Florian Diebold [Sat, 11 Dec 2021 17:47:21 +0000 (18:47 +0100)]
Fix expected type calculation in struct literal if followed by comma

2 years agoMerge #10987
bors[bot] [Sat, 11 Dec 2021 17:20:14 +0000 (17:20 +0000)]
Merge #10987

10987: fix: respect inner attributes for Structs and Enums r=lnicola a=rainy-me

fix: #10980 (the allow/deny issue is not fully resolved though.)

Co-authored-by: rainy-me <github@yue.coffee>
2 years agofix: lookup upwards for struct and enum
rainy-me [Sat, 11 Dec 2021 16:23:27 +0000 (01:23 +0900)]
fix: lookup upwards for struct and enum

2 years agoMerge #10965
bors[bot] [Sat, 11 Dec 2021 15:06:52 +0000 (15:06 +0000)]
Merge #10965

10965: minor: Remove dead assists-related function r=Veykril a=lnicola

Unless I'm missing something, `assists_with_fixes` seems to be always used and ends up in the same code path.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #10956 #10986
bors[bot] [Sat, 11 Dec 2021 14:58:07 +0000 (14:58 +0000)]
Merge #10956 #10986

10956: minor: Bump deps r=Veykril a=lnicola

bors r+

10986: fix: Fix lint completions not working for unclosed attributes r=Veykril a=Veykril

Fixes #10682
Uses keywords and nested `TokenTree`s as a heuristic to figure out when to stop parsing in case the attribute is unclosed which should work pretty well as attributes are usually followed by either of those.
bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix lint completions not working for unclosed attributes
Lukas Wirth [Sat, 11 Dec 2021 14:55:25 +0000 (15:55 +0100)]
fix: Fix lint completions not working for unclosed attributes

2 years agoMerge #10877
bors[bot] [Sat, 11 Dec 2021 14:49:29 +0000 (14:49 +0000)]
Merge #10877

10877: feat: make hightlighting linear r=matklad a=matklad

In https://youtu.be/qvIZZf5dmTE, we've noticed that AstIdMap does a
linear lookup when going from SyntaxNode to Id. This leads to
accidentally quadratic overall performance. Replace linear lookup with a
O(1) hashmap lookup.

Future work: don't duplicate `SyntaxNodePtr` in `AstIdMap` and switch to
"call site dependency injection" style storage (eg, store a
`HashSet<ErasedFileAstId>`).

See the explanation of the work here on YouTube :-)

As you can see from then benchmark results, this doesn't actually make analysis stats fastre. I am a bit mystified as to why this is happening to be honest.

Baseline
```
Database loaded:     598.40ms, 304minstr, 118mb (metadata 390.57ms, 21minstr, 841kb; build 111.31ms, 8764kinstr, -214kb)
  crates: 39, mods: 824, decls: 18647, fns: 13910
Item Collection:     9.70s, 75ginstr, 377mb
  exprs: 382426, ??ty: 387 (0%), ?ty: 285 (0%), !ty: 145
Inference:           43.16s, 342ginstr, 641mb
Total:               52.86s, 417ginstr, 1018mb
```

This PR:
```
Database loaded:     626.34ms, 304minstr, 118mb (metadata 416.26ms, 21minstr, 841kb; build 113.67ms, 8750kinstr, -209kb)
  crates: 39, mods: 824, decls: 18647, fns: 13910
Item Collection:     10.16s, 75ginstr, 389mb
  exprs: 382426, ??ty: 387 (0%), ?ty: 285 (0%), !ty: 145
Inference:           44.51s, 342ginstr, 644mb
Total:               54.67s, 417ginstr, 1034mb
```

I think we probably should merge the first commit here, but not the second.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>