Commit Graph

8661 Commits

Author SHA1 Message Date
Josh Mcguigan
7ba934fe58 fill match arms with empty block rather than unit tuple 2020-03-23 19:23:30 -07:00
bors[bot]
f9494f1147
Merge #3697
3697: update itertools version to 0.9.0 r=matklad a=JoshMcguigan

Updating `itertools` version per [feedback on #3689](https://github.com/rust-analyzer/rust-analyzer/pull/3689#discussion_r396267680) from @SomeoneToIgnore.

Worth noting that `chalk` still uses `itertools` v0.8.2, so perhaps it is worth a PR to update that repo as well so we don't have to build both versions?

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-23 23:27:37 +00:00
Josh Mcguigan
df58ab8963 update itertools version to 0.9.0 2020-03-23 16:22:46 -07:00
bors[bot]
eff1b3fe4d
Merge #3689
3689: implement fill match arm assist for tuple of enums r=matklad a=JoshMcguigan

This updates the fill match arm assist to work in cases where the user is matching on a tuple of enums. 

Note, for now this does not apply when some match arms exist (other than the trivial `_`), but I think this could be added in the future.

I think this also lays the groundwork for filling match arms when matching on tuples of non-enum values, for example a tuple of an enum and a boolean.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-23 16:41:46 +00:00
Aleksey Kladov
b605271d7f Fix formatting 2020-03-23 15:20:49 +01:00
Aleksey Kladov
aaa6961aa6 fix release more 2020-03-23 15:08:05 +01:00
Aleksey Kladov
f0a5fe8699 fix release more 2020-03-23 14:50:02 +01:00
Aleksey Kladov
59f6bf87d6 Fix release 2020-03-23 14:33:44 +01:00
Aleksey Kladov
f8fd242199
Merge pull request #3686 from Veetaha/feature/hover-actual-type-params
ra_hir: add more privacy for Type
2020-03-23 14:06:54 +01:00
Aleksey Kladov
a2f7ca27c0
Merge pull request #3678 from edwin0cheng/refactor-rename
Fix rename argument in macro call
2020-03-23 14:06:40 +01:00
Josh Mcguigan
bc48c9d511 review comments 2020-03-23 05:19:09 -07:00
bors[bot]
851a03492e
Merge #3690
3690: ra_hir: add more docs r=matklad a=Veetaha

Cited from [hear](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/hover/near/191446937)

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-23 12:06:11 +00:00
veetaha
e6691844db ra_hir: fix typo 2020-03-23 14:04:50 +02:00
veetaha
0fc21bd303 ra_hir: add more docs 2020-03-23 14:00:51 +02:00
bors[bot]
a27f5e3e05
Merge #3632
3632: ra_cargo_watch: log errors r=matklad a=Veetaha

Until this moment we totally ignored all the errors from cargo process. Though this is still true, but we
now try to log ones that are critical (i.e. misconfiguration errors and ignore compile errors).

This fixes #3631, and gives us a better error message to more gracefully handle the #3265
![image](https://user-images.githubusercontent.com/36276403/76958683-d7e1f080-6920-11ea-83d8-04561c11ccc4.png)

Though I think that outputting this only to `Output` channel is not enough. We should somehow warn the user that he passed wrong arguments to `cargo-watch.args`. I didn't bother looking for how to do this now, but this PR at least gives us something.

*cc* @kiljacken @matklad 

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-03-23 11:55:26 +00:00
bors[bot]
c7a2052e73
Merge #3681
3681: Only include machine-applicable suggestions r=kiljacken a=lnicola

Fixes #3676
Fixes #3633
Fixes #3391 

r? @kiljacken

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-03-23 11:41:32 +00:00
Josh Mcguigan
2afccbe477 implement fill match arm assist for tuple of enums 2020-03-22 23:28:25 -07:00
veetaha
559aeb2932 ra_hir: add more privacy for Type 2020-03-23 02:01:07 +02:00
bors[bot]
baa11d52f4
Merge #3684
3684: ra_hir_def: fix typo r=edwin0cheng a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-22 19:59:05 +00:00
veetaha
dc1fbef985 ra_hir_def: fix typo 2020-03-22 19:38:55 +02:00
bors[bot]
9328aba706
Merge #3677
3677: Add support for macro in symbol_index r=kjeremy a=edwin0cheng

This PR allows macro showing up in `Open symbol` search:

![show_macro](https://user-images.githubusercontent.com/11014119/77244297-548d0b80-6c4e-11ea-8613-15926cc297b3.png)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-22 14:50:42 +00:00
Laurențiu Nicola
96da53fc56 Only include machine-applicable suggestions 2020-03-22 16:45:15 +02:00
bors[bot]
39adefc4a7
Merge #3680
3680: Bump proc-macro-hack and syn r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-03-22 14:40:59 +00:00
Jeremy Kolb
d19a5c04ea Bump proc-macro-hack and syn 2020-03-22 10:39:35 -04:00
bors[bot]
655b4f16f0
Merge #3679
3679: Some miniscule refactorings r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-22 14:17:06 +00:00
Edwin Cheng
af8c37cb57
Fix typo
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-22 22:01:48 +08:00
veetaha
bfb6e3fd83 ra_hir: migrate some stuff to matches!() 2020-03-22 15:45:32 +02:00
veetaha
a8e5da8a70 ra_hir_ty: fix formatting 2020-03-22 15:44:38 +02:00
Edwin Cheng
6d5443ef94 Add test 2020-03-22 19:53:34 +08:00
Edwin Cheng
cba4dd1a8a Improve find_all_ref work inside macro 2020-03-22 19:53:28 +08:00
Edwin Cheng
f647faac60 Refactor search 2020-03-22 19:52:45 +08:00
Edwin Cheng
532e178f8e Add find_node_at_offset_with_descend 2020-03-22 19:52:14 +08:00
veetaha
8be28a2d4f ra_cargo_watch: log exit code too 2020-03-22 12:01:49 +02:00
Edwin Cheng
bb22a4e386 Add support for macro in symbo_index 2020-03-22 15:00:44 +08:00
Veetaha
788b29d343
Smol self-nit 2020-03-22 01:27:03 +02:00
bors[bot]
6fe956420f
Merge #3673
3673: Add recursive limit for macro expansion when expanding expression r=flodiebold a=edwin0cheng

cc @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-21 22:39:06 +00:00
veetaha
8414342640 fix: typo 2020-03-21 23:37:15 +02:00
veetaha
ce73c43848 ra_cargo_watch: return Result<> from run_cargo(), and don't read stderr for now
As stated by matklad, reading the stderr
should be done alngside with
stdout via select() (or I guess poll()),
there is no such implementation in stdlib,
since it is quite low level and platform-dependent and it
also requires quite a bit of unrelated code we don't use it for now.

As referenced by bjorn3, there is an implementation of the needed read2() function
in rustc compiletest. The better solution will be to extract this function
to a separate crate in future:
https://github.com/rust-analyzer/rust-analyzer/pull/3632#discussion_r395605298
2020-03-21 23:37:15 +02:00
veetaha
59ba386bee ra_cargo_watch: log more errors 2020-03-21 23:36:31 +02:00
bors[bot]
fdb12f3e0e
Merge #3672
3672: gen_assists_docs skip hidden files r=JoshMcguigan a=JoshMcguigan

Fixes #3670 

Skips hidden files when generating assist docs, which fixes an issue where the tests would fail while an editor has created a temp file in the assists directory.

There is similar logic [here](2720e2374b/xtask/tests/tidy-tests/main.rs (L157)), although in that case the `DirEntry` is a `walkdir::DirEntry` rather than a `fs::DirEntry`. Also, it's not immediately clear that it is worth moving this functionality to somewhere accessible from both of these places and creating dependencies in this way. Let me know if this is off the mark.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-21 18:27:23 +00:00
bors[bot]
a2b5fbb076
Merge #3674
3674: Use target-name for crate-name in Crate graph building r=matklad a=edwin0cheng

Fix #3667

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-21 17:21:53 +00:00
Edwin Cheng
d62dd63256 Use target-name for crate-name 2020-03-22 01:09:38 +08:00
Josh Mcguigan
90c66470f9 gen_assists_docs skip hidden files 2020-03-21 09:39:45 -07:00
bors[bot]
50c6a315ab
Merge #3671
3671: Add identity expansion checking in ill-form expansion  r=flodiebold a=edwin0cheng

This PR try to add more checking code in error case in macro expansion. The bug in #3642 is introduced by  #3580 , which allow ill-form macro expansion in *all* kind of macro expansions. 

In general we should separate hypothetical macro expansion and the actual macro expansion call. However, currently the `Semantic`  workflow we are using only support single macro expansion type, we might want to review it and make it works in both ways. (Maybe add a field in `MacroCallLoc` for differentiation) 

Fix #3642

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-21 16:02:07 +00:00
Edwin Cheng
92cc6c9816 Add recursive limit in expression macro expansion 2020-03-21 23:58:47 +08:00
Edwin Cheng
9ff50d7e83 Move test to hir_ty 2020-03-21 23:41:07 +08:00
Edwin Cheng
6d6606895c Fix typo 2020-03-21 23:08:53 +08:00
Edwin Cheng
e1a9461806 Add identity expansion checking 2020-03-21 22:43:48 +08:00
bors[bot]
5e827bd948
Merge #3668
3668: disable invert-if assist for if-let r=matklad a=JoshMcguigan

Fixes #3281 

This disables the invert-if assist for if-let expressions, fixing the bug reported in #3281.

While in the exact case reported in #3281, `if let Some(_) = foo { ...`, it would be possible to invert the if-let pattern, in most cases it will not be possible, so disabling this assist for if-let expressions seems reasonable. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-21 13:59:03 +00:00
Josh Mcguigan
c3702a6b71 disable invert if assist for if-let to fix #3281 2020-03-21 06:40:18 -07:00