Commit graph

15972 commits

Author SHA1 Message Date
bors[bot]
4a1f5d367d
Merge #8187
8187: Sweep the new TraitEnvironmentQuery r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-24 18:00:18 +00:00
Jonas Schievink
4781479ab2 Sweep the new TraitEnvironmentQuery 2021-03-24 18:59:35 +01:00
bors[bot]
353aa87032
Merge #8184
8184: refine comment style of tests r=Veykril a=hi-rustin

Fix the comment style issues, it's in tests but maybe it's a little better to change it to this.

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
2021-03-24 11:31:51 +00:00
hi-rustin
eef9bdb441 refine comment style of tests 2021-03-24 19:28:50 +08:00
bors[bot]
776b1ebcb4
Merge #8168
8168: correct `convert to guard return` let_stmt r=Veykril a=hi-rustin

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

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
2021-03-24 10:55:25 +00:00
bors[bot]
2aa64831e5
Merge #8183
8183: Fix missing command error with macros r=Veykril a=brandondong

**Reproduction:**
1. Define a struct through a macro (can be via `macro_rules`, proc macro, or `include!()`).
2. !!MISSING: command!! annotation appears. Clicking on it results in an error message. No matter where the macro is called/defined, the annotation is always at the start of the file.
![image](https://user-images.githubusercontent.com/13722457/112268785-bce14500-8c34-11eb-9a23-bafd63ffd6ef.png)

**Cause:**
- For struct `A`, a `HasImpls` annotation is added just like for struct `B`. Unlike `B`, the file id for `A` is not the file we are adding annotations to but a macro file.
- The resolving step of the code lens does not succeed.

**Fix:**
- Check that the files match before computing offsets and adding `HasImpls`/`HasReferences` annotations.

Co-authored-by: Brandon <brandondong604@hotmail.com>
2021-03-24 10:17:12 +00:00
bors[bot]
5f9ba2d589
Merge #8177
8177: Limit the hints size by default r=Veykril a=SomeoneToIgnore

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8175
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/3138

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-03-24 08:53:48 +00:00
Brandon
903a2e98f9 Clean up implementation 2021-03-24 00:47:55 -07:00
bors[bot]
3e8f13d274
Merge #8182
8182: Trim down IPC json size r=edwin0cheng a=edwin0cheng

This PR try to trim down the json of proc macro IPC by ignore token id if it equals to `TokenId::unspecifed`. 

Test by following commands:
```bash
$ git clone https://github.com/gluon-lang/lsp-types.git  
$ export RA_LOG="proc_macro_api=debug"
$ rust-analyzer -q analysis-stats --load-output-dirs --with-proc-macro . 2> debug.log
$ cat debug.log | awk '/^\[DEBUG proc_macro_api::msg\] >/ {print substr($0,31)}' >expand.log
$ stat -c "%s" expand.log
```

Before: 37576726
After: 28551718

So it trimed down 75%.  

bors r+





Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-24 07:11:28 +00:00
Edwin Cheng
a2950fcb05 Trim down IPC json size 2021-03-24 15:01:37 +08:00
Brandon
0d063b8d21 Fix MISSING: command error with macros 2021-03-24 00:00:38 -07:00
hi-rustin
e992acf078 correct convert to guard return let_stmt
fix

fix

add check
2021-03-24 11:52:44 +08:00
bors[bot]
d702f10fb3
Merge #8159
8159: Ignore proc-macro stdout to prevent IPC crash r=edwin0cheng a=edwin0cheng

fixes  #7954

r? @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-23 20:06:44 +00:00
bors[bot]
c6d6a7d412
Merge #8178
8178: Show item info when hovering intra doc links r=Veykril a=Veykril

![r4uIITP0IZ](https://user-images.githubusercontent.com/3757771/112197618-91e2fb00-8c0c-11eb-9edc-a7923214d2b6.gif)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-23 19:58:03 +00:00
Lukas Wirth
caaeb92882 Cleanup intra_doc_link parsing 2021-03-23 20:56:38 +01:00
Edwin Cheng
79f583ed66 Improve message usage in proc-macro
Reuse storage for the buffer send to child process of proc-macro.
2021-03-24 03:51:06 +08:00
Edwin Cheng
f41ae64722 Ignore proc-macro stdout to prevent IPC crash 2021-03-24 03:44:28 +08:00
Lukas Wirth
8b0d0bd9c7 Show item info when hovering intra doc links 2021-03-23 19:57:04 +01:00
bors[bot]
20f8e660ca
Merge #8179
8179: cargo update r=kjeremy a=kjeremy

Removes dependency on socket2

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-03-23 18:45:22 +00:00
kjeremy
0630ff5de5 cargo update
Removes dependency on socket2
2021-03-23 14:44:26 -04:00
Kirill Bulatov
5e83a56dfb Bump the default hint length 2021-03-23 19:43:55 +02:00
bors[bot]
5f13319892
Merge #8176
8176: Cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-23 17:05:14 +00:00
Kirill Bulatov
f1e1a2c0a7 Limit the hints size by default 2021-03-23 19:04:48 +02:00
Aleksey Kladov
8b4240e026 Cleanup 2021-03-23 19:59:33 +03:00
bors[bot]
789f7aca2e
Merge #8173
8173: simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-23 16:54:35 +00:00
Lukas Wirth
6bdf505d7c simplify 2021-03-23 17:49:06 +01:00
bors[bot]
c220b34095
Merge #8174
8174: Simplify code r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-23 16:44:28 +00:00
Aleksey Kladov
e33959a888 Simplify code
changelog: skip
2021-03-23 19:41:15 +03:00
bors[bot]
c88129d563
Merge #8170
8170: Merge bang-macros and derives in name resolution r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-23 16:24:18 +00:00
Jonas Schievink
1d5d44f7f7 Merge bang-macros and derives in name resolution 2021-03-23 17:23:10 +01:00
bors[bot]
065a8e87cd
Merge #8169
8169: Make more use of the HIR in rename::rename_to_self r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-23 15:55:04 +00:00
Lukas Wirth
638dcac092 Make more use of the HIR in rename::rename_to_self 2021-03-23 16:54:21 +01:00
bors[bot]
1dbc5b7cc7
Merge #8167
8167: Use styleguide conforming import for ast nodes r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-23 14:50:29 +00:00
Aleksey Kladov
860e069d4d Use styleguide conforming import for ast nodes 2021-03-23 17:44:17 +03:00
bors[bot]
0469280c8a
Merge #8166
8166: Unify test style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-23 14:40:34 +00:00
Aleksey Kladov
7352f50ec2 Unify test style
changelog skip
2021-03-23 17:38:51 +03:00
bors[bot]
d15edf779b
Merge #8165
8165: Tweak assits API to fit mutable syntax trees r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-23 14:32:25 +00:00
Aleksey Kladov
b83c7eedcc Tweak assits API to fit mutable syntax trees
changelog: skip
2021-03-23 17:31:19 +03:00
bors[bot]
258afb8fb8
Merge #8138
8138: Set up a search scope when searching for mbe macro references r=Veykril a=Veykril

Closes #6184

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-23 12:05:45 +00:00
Lukas Wirth
395183e0b7 Cleanup Definition::search_scope 2021-03-23 13:03:55 +01:00
Lukas Wirth
7c4eb66c1a Merge hir::MacroDef::is_* into hir::MacroDef::kind 2021-03-23 11:32:14 +01:00
Lukas Wirth
bad4e48672 Set up a search scope when searching for mbe macro references 2021-03-23 11:32:10 +01:00
bors[bot]
1efd220f2f
Merge #8162
8162: Compute more mathematically well-rounded notion of transitive deps r=Veykril a=matklad

By including the crate itself, we make the resulting set closed with
respect to `transitve_reveres_dependencies` operation, as it becomes a
proper transitive closure. This just feels more proper and mathy.

And, indeed, this actually allows us to simplify call sites somewhat.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-23 10:20:47 +00:00
Aleksey Kladov
fa9c6eb456 Improve readability 2021-03-23 13:04:43 +03:00
Aleksey Kladov
ba48c0d8bd Align naming of deps and revdeps 2021-03-23 13:04:43 +03:00
Aleksey Kladov
521a26b0d2 Align semantics of deps and rev deps 2021-03-23 12:58:48 +03:00
Aleksey Kladov
45a8f37b6a Compute more mathematically well-rounded notion of transitive deps
By including the crate itself, we make the resulting set closed with
respect to `transitve_reveres_dependencies` operation, as it becomes a
proper transitive closure. This just feels more proper and mathy.

And, indeed, this actually allows us to simplify call sites somewhat.
2021-03-23 12:49:55 +03:00
bors[bot]
bf3a8eb40a
Merge #8142
8142: temp disable broken ref match completions for struct fields/methods r=matklad a=JoshMcguigan

This PR implements a temporary workaround for #8058 by disabling ref match completions for struct fields and methods. Disabling this doesn't break any existing functionality (that I am aware of) since these completions were broken.

I plan to keep working on a real fix for the underlying issue here, but I think a proper fix could take some time, so I'd prefer to quickly fix the bug to buy some more time to implement a better solution (which would ultimately allow re-enabling ref matches for struct fields and methods). 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2021-03-23 09:24:26 +00:00
Josh Mcguigan
18c3fb2df5 add unit test to demonstrate struct fields/methods do not get ref match completions 2021-03-22 20:34:02 -07:00
bors[bot]
4b997b8663
Merge #8156
8156: Correctly lower TraitRefs with default params r=flodiebold a=Veykril

Fixes #5685

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-22 20:39:58 +00:00