Commit graph

16004 commits

Author SHA1 Message Date
cynecx 5ff3299dd6 syntax: return owned string instead of leaking string 2021-03-26 18:30:59 +01:00
bors[bot] 4ecaad98e0
Merge #8056
8056: completion relevance consider if types can be unified r=JoshMcguigan a=JoshMcguigan

This PR improves completion relevance scoring for generic types, in cases where the types could unify. 

### Before

![pre-could-unify](https://user-images.githubusercontent.com/22216761/111338556-46d94e80-8634-11eb-9936-2b20eb9e6756.png)

### After

![post-could-unify](https://user-images.githubusercontent.com/22216761/111338598-4e005c80-8634-11eb-92e0-69c2c1cda6fc.png)

changelog feature improve completions

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2021-03-26 16:29:20 +00:00
Josh Mcguigan 0e31ae2cef completion relevance distinguish between exact type match and could unify 2021-03-26 09:18:18 -07:00
Josh Mcguigan 957939292e completion relevance consider if types can be unified 2021-03-26 09:11:50 -07:00
bors[bot] 20e32fc946
Merge #8206
8206: Ignore main functions not in root module r=Veykril a=ivan770

Closes #8195

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-03-26 15:00:58 +00:00
ivan770 50e28aec25
Ignore main functions not in root module 2021-03-26 16:04:53 +02:00
bors[bot] 4cb3ecce3f
Merge #8200
8200: Use arrayvec 0.6 r=kjeremy a=lnicola

Closes #8198

changelog skip

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-25 19:09:13 +00:00
Laurențiu Nicola bc5c86543b Use more std::array::IntoIter 2021-03-25 21:06:48 +02:00
Laurențiu Nicola 9787bddac5 Use arrayvec 0.6 2021-03-25 21:03:20 +02:00
bors[bot] 59fdd7c84c
Merge #8197
8197: Rust 1.51 r=lnicola a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-03-25 15:35:36 +00:00
kjeremy bdee55d66b Rust 1.51 2021-03-25 11:34:13 -04:00
bors[bot] f6f582dec4
Merge #8193
8193: Fix manual description for rust_project.json r=Veykril a=tweksteen



Co-authored-by: Thiébaud Weksteen <tweek@google.com>
2021-03-25 10:33:05 +00:00
bors[bot] 5b8a087fc2
Merge #8194
8194: Make a full clone in `release.yaml` to bring in tags r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-25 10:18:44 +00:00
Laurențiu Nicola 27bfb1fa5c Make a full clone in release.yaml 2021-03-25 12:17:48 +02:00
Thiébaud Weksteen 1c68954a7d Fix manual description for rust_project.json 2021-03-25 10:02:16 +01:00
bors[bot] d7db38fff9
Merge #7907
7907: Autoderef with visibility r=cynecx a=cynecx

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7841.

I am not sure about the general approach here. Right now this simply tries to check whether the autoderef candidate is reachable from the current module. ~~However this doesn't exactly work with traits (see the `tests::macros::infer_derive_clone_in_core` test, which fails right now).~~ see comment below

Refs:

- `rustc_typeck` checking fields: 66ec64ccf3/compiler/rustc_typeck/src/check/expr.rs (L1610) 


r? @flodiebold

Co-authored-by: cynecx <me@cynecx.net>
2021-03-24 22:37:48 +00:00
bors[bot] 9d81618f11
Merge #8190
8190: Fix chalk_ir assertion r=flodiebold a=flodiebold

Fixes #8150.

I implemented a validator that catches this in the tests, but it'd need to get merged in Chalk first.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-24 22:13:56 +00:00
Florian Diebold b4c20e3589 Fix chalk_ir assertion
Fixes #8150.
2021-03-24 23:10:13 +01:00
cynecx d1156bb52e hir: don't use the self module as visible_from in iterate_method_candidates 2021-03-24 23:09:22 +01:00
cynecx 7155f815b9 hir_ty: don't call write_field_resolution when field candidate isn't visible 2021-03-24 23:03:38 +01:00
cynecx 96c88680b2 hir_def: move visibility queries from hir_ty to hir_def 2021-03-24 23:00:03 +01:00
bors[bot] aac6285f0b
Merge #8189
8189: Document unlinked-file diagnostic r=jonas-schievink a=jonas-schievink

fixes https://github.com/rust-analyzer/rust-analyzer/issues/8188

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-24 21:18:59 +00:00
Jonas Schievink 37c6ce34a9 Document unlinked-file diagnostic 2021-03-24 22:18:17 +01:00
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