Commit Graph

5902 Commits

Author SHA1 Message Date
Josh Mcguigan
6be972770e diagnostics cli, iterate over members 2020-04-14 16:26:03 -07: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
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
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
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
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
bors[bot]
0ecdba20df
Merge #3920
3920: Implement expand_task and list_macros in proc_macro_srv r=matklad a=edwin0cheng

This PR finish up the remain `proc_macro_srv` implementation :

1. Added dylib loading code for proc-macro crate dylib. Note that we have to add some special flags for unix loading because of a bug in old version of glibc, see https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample/issues/1 and https://github.com/rust-lang/rust/issues/60593 for details.

2. Added tests for proc-macro expansion: We use a trick here by adding `serde_derive` to dev-dependencies and calling `cargo-metadata` for searching its dylib path, and expand it in our tests. 

[EDIT]
Note that this PR **DO NOT** implement the final glue code with rust-analzyer and proc-macro-srv yet.
 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-11 11:49:07 +00:00
Geoffrey Copin
21443f1b48 Remove Option unwraping 2020-04-11 12:58:20 +02:00
Edwin Cheng
73e512215a Fix non canonicallized path for crate file 2020-04-11 18:12:50 +08:00
Edwin Cheng
31d163aa3b Improve error handling 2020-04-11 14:53:13 +08:00
Josh Mcguigan
d1338354ca fix match arm false positive 2020-04-10 20:14:53 -07:00
Aleksey Kladov
c1244c853c Forward compat 2020-04-11 00:27:00 +02:00
Chris Hopman
af04d45d32 Change missing impl assist to use todo!() instead of unimplemented()
todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html)

Rust documentation provides further clarification:

> The difference between unimplemented! and todo! is that while todo!
> conveys an intent of implementing the functionality later and the
> message is "not yet implemented", unimplemented! makes no such claims.

todo!() seems more appropriate for assists that insert missing impls.
2020-04-10 13:56:12 -07:00
Aleksey Kladov
1b68c72fe9 Move timeit to stdx 2020-04-10 20:46:42 +02:00
Aleksey Kladov
72a0db8dc4 profile queries 2020-04-10 20:25:55 +02:00
Aleksey Kladov
428d4dfe71 Fix accidently quadratic behavior when processing includes
closes #3927
2020-04-10 19:43:37 +02:00
Aleksey Kladov
5e2f29af85 Add failing test 2020-04-10 19:43:37 +02:00
Aleksey Kladov
c476742f47 Simplify 2020-04-10 17:47:49 +02:00
Aleksey Kladov
5c5bde47fb Rename some tokens 2020-04-10 17:07:09 +02:00
Aleksey Kladov
d4332760d8 Better readability 2020-04-10 16:10:28 +02:00
Aleksey Kladov
e0f02d233f Remove dead code 2020-04-10 16:10:28 +02:00
Aleksey Kladov
4560fe2abf Generate only minimal set of ineresting tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
8d71a6bf0c Scale token generation back 2020-04-10 16:10:28 +02:00