Commit Graph

10984 Commits

Author SHA1 Message Date
Jonas Schievink
500d8b2f60 Handle bindings after @ in patterns 2020-06-21 15:19:38 +02:00
bors[bot]
6d0a765d34
Merge #4962
4962: Implement APIs for parsing expressions, types, paths, patterns and items r=davidlattimore a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-06-21 12:37:29 +00:00
David Lattimore
bc99e95d7d Implement APIs for parsing expressions, types, paths, patterns and items 2020-06-21 22:28:17 +10:00
bors[bot]
50dad50188
Merge #4959
4959: Syntax highlighting for documentation comments on macro definitions r=matklad a=ltentrup

Two minor changes with regards to syntax highlighting of comments attached to macro definitions.

Before
<img width="290" alt="Bildschirmfoto 2020-06-20 um 00 05 19" src="https://user-images.githubusercontent.com/201808/85182705-c561b500-b289-11ea-944e-0bdf6508a44f.png">

After
<img width="288" alt="Bildschirmfoto 2020-06-20 um 00 03 36" src="https://user-images.githubusercontent.com/201808/85182727-d90d1b80-b289-11ea-9d2d-234731f19302.png">
Fixes #4949

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-06-21 12:05:16 +00:00
bors[bot]
fe254857e6
Merge #4963
4963: Download artifacts into tmp dir r=matklad a=Veetaha

This should prevent partially downloaded files in cases when the user closes vsode before the download is complete.
There is also a new more descriptive error message when the user has multiple vscode windows open and tries to download the server.
Related: https://github.com/rust-analyzer/rust-analyzer/issues/4938#issuecomment-646738360

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-21 09:26:47 +00:00
bors[bot]
04d64267de
Merge #4947
4947: Replace `impls_in_trait` query with smarter use of `CrateImplDefs` r=matklad a=jonas-schievink

`impls_in_trait` was allocating a whopping ~400 MB of RAM when running analysis-stats on r-a itself.

Remove it, instead adding a query that computes a summary `CrateImplDefs` map for all transitive dependencies. This can probably still be made more efficient, but this already reduces the peak memory usage by 25% without much performance impact on analysis-stats.

**Before**:

```
Total: 34.962107188s, 2083mb allocated 2141mb resident
   422mb ImplsForTraitQuery (deps)
   250mb CrateDefMapQueryQuery
   147mb MacroArgQuery
   140mb TraitSolveQuery (deps)
    68mb InferQueryQuery (deps)
    62mb ImplDatumQuery (deps)
```

**After**:

```
Total: 35.261100358s, 1520mb allocated 1569mb resident
   250mb CrateDefMapQueryQuery
   147mb MacroArgQuery
   144mb TraitSolveQuery (deps)
    68mb InferQueryQuery (deps)
    61mb ImplDatumQuery (deps)
    45mb BodyQuery
    45mb ImplDatumQuery
```

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-06-20 22:14:21 +00:00
bors[bot]
92fef01f65
Merge #4964
4964: Move ReqQueue to lsp-server r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-20 21:24:54 +00:00
Aleksey Kladov
f3cf85ab48 Move ReqQueue to lsp-server 2020-06-20 23:24:16 +02:00
bors[bot]
b575b02449
Merge #4961
4961: Centralize handing of in-flight requests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-20 19:39:41 +00:00
bors[bot]
c8557b91a3
Merge #4958
4958: Infer FnSig via Fn traits r=flodiebold a=adamrk

Addresses https://github.com/rust-analyzer/rust-analyzer/issues/4481.
When inferring types check if the callee implements one of the builtin `Fn` traits. Also autoderef the callee before trying to figure out it's `FnSig`. 

Co-authored-by: adamrk <ark.email@gmail.com>
2020-06-20 15:10:35 +00:00
adamrk
1629fb770e Push obligation instead of matching on solution 2020-06-20 17:00:57 +02:00
Veetaha
dceb81856e Download artifacts into tmp dir 2020-06-20 15:45:30 +03:00
Aleksey Kladov
93605c49ba Centralize handing of in-flight requests 2020-06-20 13:06:11 +02:00
adamrk
d8f5192d99 Get Output assoc type by name 2020-06-20 11:53:55 +02:00
adamrk
f07338bae2 Add test for dyn Fn Output 2020-06-20 11:43:40 +02:00
adamrk
436dcd9656 move tests to ra_hir_ty 2020-06-20 11:32:01 +02:00
adamrk
f0c8058f12 Fixes to callable_sig_from_fn_trait 2020-06-20 11:04:46 +02:00
adamrk
38f6cdbc8a Make get_fn_trait a method of FnTrait 2020-06-20 08:42:35 +02:00
adamrk
cf870af807 Switch back callable_sig for known fn types 2020-06-20 08:26:31 +02:00
Jonas Schievink
a3c2f5126f Recursively compute impl sets 2020-06-20 00:36:02 +02:00
Leander Tentrup
df5b37cb61 Syntax highlighting for documentation comments on macro definitions 2020-06-20 00:02:42 +02:00
bors[bot]
0f7961d557
Merge #4952
4952: Shift bound variables correctly when using assoc type shorthand r=matklad a=flodiebold

Fixes #4885.
Fixes #4800.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-19 21:40:59 +00:00
bors[bot]
af0dcc5481
Merge #4951
4951: Don't panic on crates depending on themselves r=matklad a=flodiebold

Fixes #3883.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-19 21:28:32 +00:00
bors[bot]
491eda61e3
Merge #4955
4955: Update workaround comment r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-19 21:18:18 +00:00
Jonas Schievink
a91c2e94b7 Add new query to stats 2020-06-19 23:17:53 +02:00
adamrk
3f94a90c7b Infer FnSig from Fn traits 2020-06-19 22:51:25 +02:00
Jonas Schievink
aa8442af70 Don't include downstream crate in query 2020-06-19 22:33:13 +02:00
Florian Diebold
170cdf9076 Shift bound variables correctly when using assoc type shorthand
Fixes #4885.
Fixes #4800.
2020-06-19 22:07:58 +02:00
bors[bot]
1d4388f6bd
Merge #4950
4950: Use correct substs for super trait assoc types r=matklad a=flodiebold

When referring to an associated type of a super trait, we used the substs of the
subtrait. That led to the #4931 crash if the subtrait had less parameters, but
it could also lead to other incorrectness if just the order was different.

Fixes #4931.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-19 19:47:30 +00:00
Florian Diebold
2745cb37c1 Use correct substs for super trait assoc types
When referring to an associated type of a super trait, we used the substs of the
subtrait. That led to the #4931 crash if the subtrait had less parameters, but
it could also lead to other incorrectness if just the order was different.

Fixes #4931.
2020-06-19 21:46:47 +02:00
bors[bot]
6654055308
Merge #4957
4957: Fix substs in resolve_value_path for ImplSelf r=flodiebold a=Speedy37

Fixes #4953.

This is the first fix I do in hir_ty, I hope I got it right :)


Co-authored-by: Vincent Rouillé <vincent@speedy37.fr>
2020-06-19 18:48:06 +00:00
Vincent Rouillé
c95bb0ba7b
Fix substs in resolve_value_path for ImplSelf
Fixes #4953.
2020-06-19 20:33:04 +02:00
Veetaha
d6e89244ec Update workaround comment 2020-06-19 20:52:06 +03:00
Florian Diebold
584bddef0c Don't panic on crates depending on themselves
Fixes #3883.
2020-06-19 18:38:03 +02:00
bors[bot]
90a5c4626a
Merge #4851
4851: Add quickfix to add a struct field r=TimoFreiberg a=TimoFreiberg

Related to #4563 
I created a quickfix for record literals first because the NoSuchField diagnostic was already there.
To offer that quickfix for FieldExprs with unknown fields I'd need to add a new diagnostic (or create a `NoSuchField` diagnostic for those cases)

I think it'd make sense to make this a snippet completion (to select the generated type), but this would require changing the `Analysis` API and I'd like some feedback before I touch that.

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-06-19 15:08:52 +00:00
bors[bot]
ec6df5d3e8
Merge #4937
4937: Allow overriding rust-analyzer display version r=matklad a=oxalica

The build script invokes `git` for version information which is displayed when rust-analyzer is called with `--version`. But in build environment without `git` or when the source code is not a git repo, there's no way to manually specify the version information.

This patch respects environment variable ~`REV`~ `RUST_ANALYZER_REV` in compile time for overriding.

Related: https://github.com/NixOS/nixpkgs/pull/90976

Co-authored-by: oxalica <oxalicc@pm.me>
2020-06-19 13:43:42 +00:00
bors[bot]
4575c38810
Merge #4839
4839: `Go to Type Definition` hover action. r=matklad a=vsrs

![hover_actions_goto](https://user-images.githubusercontent.com/62505555/83335671-0122e380-a2b7-11ea-9922-fbdcfb11a7f3.gif)

This implementation supports things like `dyn Trait<SomeType>`, `-> impl Trait`, etc.

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-19 13:34:24 +00:00
bors[bot]
f6e250bd1b
Merge #4948
4948: Speedup VFS::partition r=matklad a=matklad

The task of `partition` function is to bin the flat list of paths into
disjoint filesets. Ideally, it should be incremental -- each new file
should be added to a specific fileset.

However, preliminary measurnments show that it is actually fast enough
if we just optimize this to use a binary search instead of a linear
scan.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-19 13:10:52 +00:00
Aleksey Kladov
b9f3c5d585 Speedup VFS::partition
The task of `partition` function is to bin the flat list of paths into
disjoint filesets. Ideally, it should be incremental -- each new file
should be added to a specific fileset.

However, preliminary measurnments show that it is actually fast enough
if we just optimize this to use a binary search instead of a linear
scan.
2020-06-19 15:07:32 +02:00
Jonas Schievink
ebd8233b3e Replace impls_in_trait with CrateImplDefs 2020-06-19 01:29:34 +02:00
Benjamin Coenen
4c89d32f7a do not suggest assist for return type to result in bad case #4826
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-18 22:16:39 +02:00
bors[bot]
902a9c6da7
Merge #4930
4930: Avoid all unchecked indexing in match checking r=flodiebold a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/4416, but replaces it with a false positive.

r? @flodiebold 

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-06-18 19:43:05 +00:00
Benjamin Coenen
3f26c5758d don't complete top level attrs inside nested attrs and add better labels #4890
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-18 21:31:49 +02:00
oxalica
f9ce7cd961
Fix fmt 2020-06-19 02:25:07 +08:00
oxalica
bed0b794e5
Allow overriding rust-analyzer display revision 2020-06-18 22:33:23 +08:00
bors[bot]
1e35c74055
Merge #4941
4941: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-18 14:05:54 +00:00
Aleksey Kladov
42be05a335 Simplify 2020-06-18 16:02:45 +02:00
bors[bot]
f7f627d342
Merge #4903
4903: Add highlighting support for doc comments r=matklad a=Nashenas88

The language server protocol includes a semantic modifier for documentation. This change exports that modifier for doc comments so users can choose to highlight them differently compared to regular comments.

Example:
<img width="375" alt="Screen Shot 2020-06-16 at 10 34 14 AM" src="https://user-images.githubusercontent.com/1673130/84788271-f6599580-afbc-11ea-96e5-7a0215da620b.png">

CC @woody77 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-06-18 13:23:14 +00:00
Paul Daniel Faria
66fc084a86 Remove logic to mark all doctest code as 2020-06-18 09:14:02 -04:00
Veetaha
6e81c9a921 Flatten Task enum ¯\_(ツ)_/¯ 2020-06-18 15:02:36 +03:00