Commit Graph

11114 Commits

Author SHA1 Message Date
David Lattimore
83588a1c45 SSR: Use T! instead of SyntaxKind::* where possible 2020-07-02 09:19:58 +10:00
David Lattimore
3d9997889b SSR: Add initial support for placeholder constraints 2020-07-01 18:44:11 +10:00
bors[bot]
d34fd372bb
Merge #5098
5098: Bump npm deps r=Veetaha a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-07-01 08:18:57 +00:00
bors[bot]
dd3ad2bd41
Merge #5154 #5157
5154: Structured search debugging r=matklad a=davidlattimore

Adds a "search" mode to the rust-analyzer binary that does structured search (SSR without the replace part). This is intended primarily for debugging why a bit of code isn't matching a pattern.

5157: Use dynamic dispatch in AstDiagnostic r=matklad a=lnicola



Co-authored-by: David Lattimore <dml@google.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 08:11:23 +00:00
bors[bot]
686e115e73
Merge #5158
5158: Use CrateName correctly r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 08:03:47 +00:00
Aleksey Kladov
80386ca5be Use Strings for display names 2020-07-01 10:03:07 +02:00
Aleksey Kladov
307c6fec61 Use CrateName for semantic names 2020-07-01 09:53:53 +02:00
Laurențiu Nicola
1be5e848b0 Use dynamic dispatch in AstDiagnostic 2020-07-01 10:46:27 +03:00
bors[bot]
30c2e714cc
Merge #5156
5156: Remove db from AssistsContext r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 07:35:18 +00:00
Laurențiu Nicola
331e6d8f16 Remove db from AssistsContext 2020-07-01 10:25:59 +03:00
bors[bot]
98ae447fa7
Merge #5153
5153: Make SemanticsScope non-generic r=matklad a=lnicola

This slightly reduces the build times:

![image](https://user-images.githubusercontent.com/308347/86210975-3a809480-bb7e-11ea-8975-788457f6b353.png)

(compare to https://github.com/rust-analyzer/rust-analyzer/issues/1987#issuecomment-652202248)

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 07:17:16 +00:00
bors[bot]
5749c42b71
Merge #5155
5155: FileSetConfig works with empty set of roots r=matklad a=matklad

Closes #5139



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 07:08:26 +00:00
Aleksey Kladov
e336a96998 FileSetConfig works with empty set of roots
Closes #5139
2020-07-01 09:06:51 +02:00
David Lattimore
95f8310514 Structured search debugging 2020-07-01 16:50:45 +10:00
Laurențiu Nicola
5953cbd7ae Make SemanticsScope non-generic 2020-07-01 09:34:45 +03:00
Laurențiu Nicola
538980b10e Be more strict with @types/node
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-07-01 08:01:17 +03:00
bors[bot]
b1a2d01645
Merge #5142
5142: analysis-stats: allow parallel type inference r=matklad a=jonas-schievink

This is mostly just for testing/fun, but it looks like type inference can be sped up massively with little to no effort (since it runs after the serial phases are already done).

Without `--parallel`:

```
Item Collection: 16.43597698s, 683mb allocated 720mb resident
Inference: 25.429774879s, 1720mb allocated 1781mb resident
Total: 41.865866352s, 1720mb allocated 1781mb resident
```

With `--parallel`:

```
Item Collection: 16.380369815s, 683mb allocated 735mb resident
Parallel Inference: 7.449166445s, 1721mb allocated 1812mb resident
Inference: 143.437157ms, 1721mb allocated 1812mb resident
Total: 23.973303611s, 1721mb allocated 1812mb resident
```

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-30 21:17:54 +00:00
bors[bot]
c78180c318
Merge #5152
5152: Don't crash on empty out_dirs with older cargos r=matklad a=matklad

closes #5125



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 20:15:37 +00:00
Aleksey Kladov
cec92407f4 Don't crash on empty out_dirs with older cargos
closes #5125
2020-06-30 22:12:27 +02:00
bors[bot]
bad0b9aa23
Merge #5151
5151: Switch to expect for the rest of inlay tests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 19:57:34 +00:00
Aleksey Kladov
8b725a2f77 Switch to expect for the rest of inlay tests 2020-06-30 21:55:21 +02:00
bors[bot]
569c59b975
Merge #5150
5150: Bump console and insta r=kjeremy a=kjeremy

Removes clicolors-control and atty

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-06-30 19:17:00 +00:00
kjeremy
a05fba0213 Bump console and insta (removes clicolors-control and atty) 2020-06-30 15:12:36 -04:00
bors[bot]
5c342d2999
Merge #5143
5143: Fix a typo r=kjeremy a=mbrobbel



Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
2020-06-30 18:57:15 +00:00
bors[bot]
4a19d5954a
Merge #5146
5146: Simplify most of the inlay hints tests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 16:05:07 +00:00
Aleksey Kladov
442c13ba17 Simplify most of the inlay hints tests 2020-06-30 18:04:25 +02:00
Matthijs Brobbel
f640d2a09c
Fix a typo 2020-06-30 17:42:54 +02:00
Jonas Schievink
4602c2eeaa analysis-stats: allow parallel type inference 2020-06-30 17:00:17 +02:00
bors[bot]
0954d31bee
Merge #5138
5138: Refactor runnable tests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 12:18:31 +00:00
Aleksey Kladov
de464f5e4a Refactor runnable tests 2020-06-30 14:12:55 +02:00
bors[bot]
3e70d0f308
Merge #5136
5136: Split namespace maps in `ItemScope` r=jonas-schievink a=jonas-schievink

Reduces memory usage of the CrateDefMap query by ~130 MB (50%) on r-a.

I was also looking into handling glob imports more efficiently (storing scope chains instead of always duplicating everything into the glob-importing module's scope), but it seems that this already gives the most significant wins.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-30 12:10:21 +00:00
Jonas Schievink
7c9b3d154c Remove entries_without_primitives 2020-06-30 14:06:23 +02:00
Jonas Schievink
a80e8fea85 Simplify entry API usage 2020-06-30 13:54:40 +02:00
bors[bot]
6a73d544f4
Merge #5137
5137: Make gotodef tests more data-driven r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 11:30:51 +00:00
Aleksey Kladov
af7e300041 Remove confusing API 2020-06-30 13:29:53 +02:00
Jonas Schievink
56fb8a401a Reorder imports 2020-06-30 13:25:15 +02:00
Jonas Schievink
0fcbc716fd Split namespace maps in ItemScope
Reduces memory usage of the CrateDefMap query by ~130 MB on r-a.
2020-06-30 13:23:42 +02:00
Aleksey Kladov
34072d53b6 Rewrite goto implementation tests 2020-06-30 13:20:16 +02:00
Aleksey Kladov
4484908a86 Rewrite goto definition tests 2020-06-30 13:03:08 +02:00
Aleksey Kladov
d34e725f09 Better factoring 2020-06-30 12:14:16 +02:00
bors[bot]
5a0fb3caff
Merge #5135
5135: Generalize annotations r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 10:13:45 +00:00
Aleksey Kladov
d21c84abd4 Generalize annotations 2020-06-30 12:13:08 +02:00
bors[bot]
e87cba85ef
Merge #5132
5132: Fix some typos r=matklad a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-06-30 08:45:16 +00:00
bors[bot]
d13ded6cbc
Merge #5101
5101: Add expect -- a light-weight alternative to insta r=matklad a=matklad

This PR implements a small snapshot-testing library. Snapshot updating is done by setting an env var, or by using editor feature (which runs  a test with env-var set). 

Here's workflow for updating a failing test:

![expect](https://user-images.githubusercontent.com/1711539/85926956-28afa080-b8a3-11ea-9260-c6d0d8914d0b.gif)

Here's workflow for adding a new test:

![expect-fresh](https://user-images.githubusercontent.com/1711539/85926961-306f4500-b8a3-11ea-9369-f2373e327a3f.gif)

Note that colorized diffs are not implemented in this PR, but should be easy to add (we already use them in test_utils). 

Main differences from insta (which is essential for rust-analyzer development, thanks @mitsuhiko!):
* self-updating tests, no need for a separate tool
* fewer features (only inline snapshots, no redactions)
* fewer deps (no yaml, no persistence)
* tighter integration with editor
* first-class snapshot object, which can be used to write test functions (as opposed to testing macros)
* trivial to tweak for rust-analyzer needs, by virtue of being a workspace member. 

I think eventually we should converge to a single snapshot testing library, but I am not sure that `expect` is exactly right, so I suggest rolling with both insta and expect for some time (if folks agree that expect might be better in the first place!). 

# Editor Integration Implementation 

The thing I am most excited about is the ability to update a specific snapshot from the editor. I want this to be available to other snapshot-testing libraries (cc @mitsuhiko, @aaronabramov), so I want to document how this works. 

The ideal UI here would be a code action (💡). Unfortunately, it seems like it is impossible to implement without some kind of persistence (if you save test failures into some kind of a database, like insta does, than you can read the database from the editor plugin). Note that it is possible to highlight error by outputing error message in rustc's format. Unfortunately, one can't use the same trick to implement a quick fix. 

For this reason, expect makes use of another rust-analyzer feature -- ability to run a single test at the cursor position. This does need some expect-specific code in rust-analyzer unfortunately. Specifically, if rust-analyzer notices that the cursor is on `expect!` macro, it adds a special flag to runnable's JSON. However, given #5017 it is possible to approximate this well-enough without rust-analyzer integration. Specifically, an extension can register a special runner which checks (using regexes) if rust-anlyzer runnable covers text with specific macro invocation and do special magic in that case. 

closes #3835 


Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 08:34:08 +00:00
David Lattimore
ef49bbeec4 Fix some typos 2020-06-30 10:43:37 +10:00
bors[bot]
2bd7171399
Merge #5120
5120: Add a simple SSR subcommand to the rust-analyzer command line binary r=davidlattimore a=davidlattimore

Is adding the dependency on ra_ide_db OK? It's needed for the call to `db.local_roots()`

Co-authored-by: David Lattimore <dml@google.com>
2020-06-29 23:33:34 +00:00
David Lattimore
867f29559f Moved new deps to CLI-only section 2020-06-30 09:31:45 +10:00
bors[bot]
8035b0a27e
Merge #5128
5128: Update serde_json and cc r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-06-29 18:18:29 +00:00
kjeremy
ff08ae9266 Update serde_json and cc 2020-06-29 14:09:29 -04:00
bors[bot]
9f12903bb1
Merge #5119
5119: Show notification while SSR is in progress r=matklad a=davidlattimore

Ideally we would (a) show progress and (b) allow cancellation, but at least now there's some indication to the user that something is happening.

Co-authored-by: David Lattimore <dml@google.com>
2020-06-29 16:10:43 +00:00