Commit graph

9271 commits

Author SHA1 Message Date
bors[bot]
84e3304a9b
Merge #4027
4027: find_path: Builtins are always in scope r=matklad a=flodiebold

Fixes #3977.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-18 10:14:33 +00:00
Florian Diebold
b49ecafd40 find_path: Builtins are always in scope
Fixes #3977.
2020-04-18 12:06:22 +02:00
bors[bot]
0948932145
Merge #4026
4026: Omit more parameter hints in the presence of underscores r=matklad a=lnicola

Fixes #4017.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-18 09:01:41 +00:00
bors[bot]
162481d5ce
Merge #4023
4023: Fix another crash from wrong binders r=matklad a=flodiebold

Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-18 08:48:08 +00:00
Laurențiu Nicola
8a51a74556 Omit more parameter hints in the presence of underscores 2020-04-18 10:53:48 +03:00
Florian Diebold
d3cb9ea0bf Fix another crash from wrong binders
Basically, if we had something like `dyn Trait<T>` (where `T` is a type
parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be
`dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type
parameter, that's just wrong, with two, it'll lead to crashes.
2020-04-18 00:01:09 +02:00
bors[bot]
746b2e003e
Merge #4022
4022: Fix incorrect order of syntax highlight ranges r=ltentrup a=ltentrup

A fix for the bug #4013 which is caused by a difference between tree traversal order and text representation order. In the case of #4013, the attributes of a macro were visited after the macro definition which caused the syntax highlight ranges to be in wrong order. The fix is to sort the ranges before returning. 

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-04-17 20:52:46 +00:00
Leander Tentrup
2e2c03ee2d Fix incorrect order of syntax highlight ranges 2020-04-17 22:50:30 +02:00
bors[bot]
8a4cebafca
Merge #4021
4021: Fix type equality for dyn Trait r=matklad a=flodiebold

Fixes a lot of false type mismatches.

(And as always when touching the unification code, I have to say I'm looking forward to replacing it by Chalk's...)

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-04-17 18:47:08 +00:00
Florian Diebold
6a7fc76b89 Fix type equality for dyn Trait
Fixes a lot of false type mismatches.

(And as always when touching the unification code, I have to say I'm looking
forward to replacing it by Chalk's...)
2020-04-17 19:42:36 +02:00
bors[bot]
f11236e511
Merge #4019
4019: Add two more tests for associated types r=matklad a=flodiebold



Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-04-17 17:06:10 +00:00
Florian Diebold
fbd95785a6 Add two more tests for associated types 2020-04-17 18:27:38 +02:00
bors[bot]
690a0b249e
Merge #4016
4016: Don't use SyntaxNodePtr::range when determining scope for offset r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 16:05:58 +00:00
Aleksey Kladov
f178df1a5e Don't use SyntaxNodePtr::range when determining scope for offset 2020-04-17 18:04:49 +02:00
bors[bot]
179d983535
Merge #4012
4012: fix panic on ellipsis in pattern r=flodiebold a=JoshMcguigan

fixes #3999

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-17 12:39:20 +00:00
Josh Mcguigan
408f914bf4 fix panic on ellipsis in pattern 2020-04-17 05:36:44 -07:00
bors[bot]
48a9e20618
Merge #4011
4011: Don\t suggest import itself as a completion for import r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 12:28:57 +00:00
Aleksey Kladov
028f1e2e3a Don\t suggest import itself as a completion for import 2020-04-17 14:28:20 +02:00
bors[bot]
0262c9b9c0
Merge #4010
4010: Fix handling of ranges in diagnostics r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 11:57:29 +00:00
Aleksey Kladov
146f6f5a45 Simplify Diagnostic structure
It's not entirely clear what subnode ranges should mean in the
presence of macros, so let's leave them out for now. We are not using
them heavily anyway.
2020-04-17 13:56:42 +02:00
Aleksey Kladov
a8196ffe84 Correctly highlight ranges of diagnostics from macros
closes #2799
2020-04-17 13:56:38 +02:00
Aleksey Kladov
302bf97bbf Don't expose impl details of SyntaxPtr 2020-04-17 12:25:41 +02:00
bors[bot]
bd6b532224
Merge #4009
4009: Better snippet when completing trait method r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-17 10:06:01 +00:00
Aleksey Kladov
3b75bc154f Better snippet when completing trait method 2020-04-17 12:05:35 +02:00
bors[bot]
46105cdaba
Merge #4004
4004: Use mmap for proc macro libs r=matklad a=lnicola

Fixes #4002.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-17 09:40:53 +00:00
Laurențiu Nicola
93fcf1c133 Use mmap for proc macro libs 2020-04-17 12:38:38 +03:00
bors[bot]
f8016b8194
Merge #3996
3996: Fix path for proc-macro in nightly / stable release r=matklad a=edwin0cheng

I messed up that I forget we use different executable names for nightly / stable release, I changed to use the current executable name instead.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-17 09:31:57 +00:00
bors[bot]
69f0cb6cd7
Merge #4008
4008: tests: add more info about what failed in tidy tests r=matklad a=bnjjj

Separate PR from #3954

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 08:40:02 +00:00
bors[bot]
d426462b48
Merge #4007
4007: Reduce allocations when looking up proc macro decl r=edwin0cheng a=lnicola

`libserde_derive` has about 21K symbols on Linux. It's not much, but let's ~~not be wasteful~~ avoid the allocations anyway.

r? @edwin0cheng

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-17 08:32:20 +00:00
Benjamin Coenen
828f69ce54 tests: add more info about what failed in tidy tests
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:32:12 +02:00
Laurențiu Nicola
02b96d522c Reduce allocations when looking up proc macro decl 2020-04-17 11:12:05 +03:00
Edwin Cheng
ef6ee16006 Fix path for proc-macro in nightly / stable build 2020-04-17 04:45:03 +08:00
bors[bot]
8d296be109
Merge #3995
3995: Separate project discovery from project loading r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-16 20:36:19 +00:00
Aleksey Kladov
422ae477ce Unmix error handling when discovering workspaces
Hitting an io::Error is a legit problem. Finding more than one
Cargo.toml is not.
2020-04-16 22:35:50 +02:00
bors[bot]
10d8cb913c
Merge #3958
3958: Add proc-macro related config and tests r=matklad a=edwin0cheng

This PR do the following things:

1. Add cli argument `proc-macro` for running proc-macro server.
2. Added support for proc-macro in bench and analysis-stats
3. Added typescript config for proc-macros
4. Added an heavy test for proc-macros. 

To test it out: 

1. run `cargo xtask install --proc-macro`
2. add `"rust-analyzer.cargo.loadOutDirsFromCheck": true"` and `"rust-analyzer.procMacro.enabled": true"` in vs code config.

[Edit] Change to use `rust-analyzer proc-macro` for running proc-macro standalone process.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-16 20:21:59 +00:00
Edwin Cheng
16a74cfd23 Remove ci changes 2020-04-17 04:11:49 +08:00
Edwin Cheng
b4c5ee33ae Fix extern_process args 2020-04-17 04:08:01 +08:00
Aleksey Kladov
be2654b0ed Decouple project loading from project discovery a bit 2020-04-16 22:02:10 +02:00
bors[bot]
a4cda3efbb
Merge #3994
3994: Don't expose SyntaxNodePtr impl details r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-16 19:01:30 +00:00
Aleksey Kladov
cae2498513 Don't expose SyntaxNodePtr impl details 2020-04-16 21:01:04 +02:00
bors[bot]
fc0a47a0c1
Merge #3992
3992: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-16 13:45:12 +00:00
Edwin Cheng
177becea98 Add proc-macro cli command for rust-analyzer 2020-04-16 21:13:57 +08:00
kjeremy
45b0826499 cargo update 2020-04-16 09:13:44 -04:00
bors[bot]
0390d62168
Merge #3979
3979: fix missing match arm false positive for enum with no variants r=flodiebold a=JoshMcguigan

fixes #3974

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-16 12:57:31 +00:00
bors[bot]
7d60a446fc
Merge #3990
3990: Switch to Chalk recursive solver r=matklad a=flodiebold

Before:
```
Expressions of unknown type: 5526 (3%)
Expressions of partially unknown type: 5415 (3%)
```
After:
```
Expressions of unknown type: 4600 (2%)
Expressions of partially unknown type: 4645 (2%)
```

On the other hand,
```
'./target/release/rust-analyzer analysis-stats -q . # old solver' ran
    1.24 ± 0.04 times faster than 'rust-analyzer analysis-stats -q . # new solver'
```
I think part of this just comes from the fact that we're inferring more types now; but apart from that, it should be possible to improve the performance a bunch, and I'll make looking into that a priority.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-16 12:50:19 +00:00
Josh Mcguigan
360bdf653b fix false positive for enum with no variants 2020-04-16 05:37:49 -07:00
Edwin Cheng
ca7dc69a8e Add tests for proc_macro 2020-04-16 19:28:06 +08:00
Edwin Cheng
a4b0ce07f8 Add config for proc_macro 2020-04-16 19:28:06 +08:00
Edwin Cheng
22e33f308a Add with-proc-macro in bench ,stats and diagnositcs 2020-04-16 19:27:44 +08:00
Florian Diebold
39fe3a6486 Test for non-working proc macro server assoc types 2020-04-16 13:06:23 +02:00