Commit graph

9200 commits

Author SHA1 Message Date
bors[bot]
d6327297e4
Merge #3978
3978: insta 0.16 r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-15 08:31:18 +00:00
bors[bot]
b495e56b0d
Merge #3971
3971: add diagnostics subcommand to rust-analyzer CLI r=JoshMcguigan a=JoshMcguigan

This PR adds a `diagnostics` subcommand to the rust-analyzer CLI. The intent is to detect all diagnostics on a workspace. It returns a non-zero status code if any error diagnostics are detected. Ideally I'd like to run this in CI against the rust analyzer project as a guard against false positives.

```
$ cargo run --release --bin rust-analyzer -- diagnostics .
```

Questions for reviewers:

1. Is this the proper way to get all diagnostics for a workspace? It seems there are at least a few ways this can be done, and I'm not sure if this is the most appropriate mechanism to do this.
2. It currently prints out the relative file path as it is collecting diagnostics, but it doesn't print the crate name. Since the file name is relative to the crate there can be repeated names, so it would be nice to print some identifier for the crate as well, but it wasn't clear to me how best to accomplish this. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-14 23:35:50 +00:00
Josh Mcguigan
6be972770e diagnostics cli, iterate over members 2020-04-14 16:26:03 -07:00
kjeremy
eedab116ab insta 0.16 2020-04-14 13:57:02 -04:00
Josh Mcguigan
f9701efbe7 cli diagnostics walk files 2020-04-14 04:35:34 -07:00
Josh Mcguigan
f62c73a972 add diagnostics subcommand to rust-analyzer CLI 2020-04-13 18:40:41 -07:00
bors[bot]
c82e7696e6
Merge #3961
3961: Fix double comma when merge imports on second line r=edwin0cheng a=IceSentry

This fixes the bug when merging imports from the second line when it already has a comma it would previously insert a comma.

There's probably a better way to check for a COMMA. 

This also ends up with a weird indentation, but rust-fmt can easily deal with it so I'm not sure how to resolve that.

Closes #3832

Co-authored-by: IceSentry <c.giguere42@gmail.com>
2020-04-13 18:03:12 +00:00
IceSentry
ed0eedb1dd Fix PR 2020-04-13 13:59:30 -04:00
bors[bot]
d075f49e6d
Merge #3960
3960: ellipsis in tuple patterns r=JoshMcguigan a=JoshMcguigan

This PR lowers ellipsis in tuple patterns. It fixes a bug in the way ellipsis were previously lowered (by replacing the ellipsis with a single `Pat::Wild` no matter how many items the `..` was taking the place of).

It also uses this new information to properly handle `..` in tuple struct patterns when perform match statement exhaustiveness checks.

While this PR provides the building blocks for match statement exhaustiveness checks for tuples, there are some additional challenges there, so that is still unimplemented (unlike tuple structs).

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-13 15:20:17 +00:00
Josh Mcguigan
ee822d19b7 handle tuple patterns with ellipsis 2020-04-13 08:19:19 -07:00
IceSentry
2e279ca031 Generalize test and clean up imports 2020-04-12 21:34:01 -04:00
IceSentry
abdf725c55 Fix double comma when merge imports on second line
This fixes the a bug when merging imports from the second line when it already has a comma it would previously insert a comma.

There's probably a better way to check for a COMMA. 

This also ends up with a weird indentation, but rust-fmt can easily deal with it so I'm not sure how to resolve that.

Closes #3832
2020-04-12 21:29:14 -04:00
bors[bot]
c388130f5f
Merge #3957
3957: Remove more unnecessary braces r=kjeremy a=lnicola

See #3866.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-12 16:37:36 +00:00
Laurențiu Nicola
e809328c12 Remove more unnecessary braces 2020-04-12 18:20:03 +03:00
bors[bot]
268b798729
Merge #3938
3938: fix missing match arm false positive r=flodiebold a=JoshMcguigan

This fixes #3932 by skipping the missing match arm diagnostic in the case any of the match arms don't type check properly against the match expression. 

I think this is the appropriate behavior for this diagnostic, since `is_useful` relies on all match arms being well formed, and the case of a malformed match arm should probably be handled by a different diagnostic.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-12 08:30:24 +00:00
Josh Mcguigan
bb2e5308b7 missing match arm add test cases to demonstrate enum tuple struct with ellipsis behavior 2020-04-11 21:20:52 -07:00
Josh Mcguigan
a59179ac2d missing match arms add test cases to demonstrate behavior of tuple with pattern 2020-04-11 20:50:54 -07:00
bors[bot]
a8e032820f
Merge #3955
3955: Align grammar for record patterns and literals r=matklad a=matklad

The grammar now looks like this

   [name_ref :] pat



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-11 22:01:22 +00:00
Aleksey Kladov
5e5eb6a108 Align grammar for record patterns and literals
The grammar now looks like this

   [name_ref :] pat
2020-04-12 00:00:15 +02:00
Aleksey Kladov
6b49e774e2 Remove dead code 2020-04-11 23:08:05 +02:00
bors[bot]
f13da3f895
Merge #3953
3953: Remove #[should_panic] from call_info tests r=matklad a=kjeremy

Better fix than #3952

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-04-11 20:58:59 +00:00
Jeremy Kolb
0f5d6766fd Remove #[should_panic] from call_info tests 2020-04-11 15:47:09 -04:00
bors[bot]
fd06fe7b13
Merge #3925
3925: Implement assist "Reorder field names" r=matklad a=geoffreycopin

This PR implements the "Reorder record fields" assist as discussed in issue #3821 .

Adding a `RecordFieldPat` variant to the `Pat` enum seemed like the easiest way to handle the `RecordPat` children as a single sequence of elements, maybe there is a better way ?

Co-authored-by: Geoffrey Copin <copin.geoffrey@gmail.com>
2020-04-11 18:40:46 +00:00
Geoffrey Copin
d9089245fe Generate doc 2020-04-11 20:32:58 +02:00
Geoffrey Copin
d362fcfc1c Fix doc tests 2020-04-11 20:32:48 +02:00
Geoffrey Copin
25a0ce2e9e Add documentation comment 2020-04-11 19:39:10 +02:00
bors[bot]
1a1c09ed3e
Merge #3951
3951: Simplify records grammar r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-11 17:37:02 +00:00
Aleksey Kladov
0aece75cdd Remove dead code 2020-04-11 19:36:31 +02:00
Geoffrey Copin
270bcfdfc2 Avoid adding a RecordFieldPat variant to the Pat enum 2020-04-11 19:30:41 +02:00
Aleksey Kladov
7a39bc3ba2 Make records grammar more orthogonal
We used

  name [: expr]

grammar before, now it is

  [name :] expr

which makes things simpler
2020-04-11 19:20:41 +02:00
bors[bot]
11d400b63b
Merge #3944
3944: Look up trait impls by self type r=matklad a=flodiebold

This speeds up inference in analysis-stats by ~30% (even more with the recursive solver).

There's a slight difference in inferred types, which I think comes from pre-existing wrong handling of error types in impls, so I think it's fine.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-11 16:21:28 +00:00
Florian Diebold
a2783df3f0 Look up impls by self type
This speeds up inference in analysis-stats by ~30% (even more with the recursive
solver).
2020-04-11 18:04:09 +02:00
bors[bot]
e7a68c8f55
Merge #3949
3949: Cleanup cfg handling in items r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-11 15:55:26 +00:00
Aleksey Kladov
f980b07529 Make incremental nameres test harder 2020-04-11 17:54:46 +02:00
Aleksey Kladov
38c67e5c0d Avoid cyclic queries in name resolution when processing enums 2020-04-11 17:52:26 +02:00
Aleksey Kladov
deb40d52aa Align naming 2020-04-11 17:20:26 +02:00
Aleksey Kladov
55356332bf Remove code duplication 2020-04-11 17:18:42 +02:00
Aleksey Kladov
b8eb1597c9 Use Expander for cfg handling in structs 2020-04-11 17:17:12 +02:00
Aleksey Kladov
ac21100f32 Use Expander for cfg handling in impls 2020-04-11 17:12:17 +02:00
Aleksey Kladov
e9519e1035 Pull Expander up 2020-04-11 17:09:50 +02:00
Aleksey Kladov
6b0870d12e Simplify 2020-04-11 17:00:31 +02:00
Josh Mcguigan
aec20e5094 missing match arm add test for partially diverging type 2020-04-11 07:13:47 -07:00
Josh Mcguigan
26e5bb0a4e missing match arms add tests for match expression diverging 2020-04-11 07:07:47 -07:00
Aleksey Kladov
997c959d4f
Merge pull request #3935 from cjhopman/todo
Change missing impl assist to use todo!() instead of unimplemented()
2020-04-11 16:05:23 +02:00
bors[bot]
372414d27b
Merge #3942
3942: vscode: fix typing bug in config r=matklad a=Veetaha

I noticed that the type of nullable properties in config is actually non-nullable
![Screenshot from 2020-04-11 15-29-45](https://user-images.githubusercontent.com/36276403/79043702-6a686d80-7c09-11ea-9ae8-f1a777c7d0f2.png)


Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-11 13:26:17 +00:00
bors[bot]
0679d8cbe7
Merge #3943
3943: vscode: fix indent r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-11 12:49:03 +00:00
Aleksey Kladov
8bd14a3483
Merge pull request #3910 from lnicola/fn-named-param-hint
Hide parameter hints for single-argument functions with the same name
2020-04-11 14:48:14 +02:00
Aleksey Kladov
82c98f425c
Merge pull request #3940 from lnicola/cargo-audit
Use actions-rs/install and /audit-check for cargo-audit
2020-04-11 14:46:20 +02:00
veetaha
12e23bd60b vscode: fix typing bug in config 2020-04-11 15:40:49 +03:00
veetaha
f778242a37 vscode: fix indent 2020-04-11 15:37:06 +03:00