]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoCentralize fixture parsing for assists
Aleksey Kladov [Tue, 23 Jun 2020 22:30:34 +0000 (00:30 +0200)]
Centralize fixture parsing for assists

4 years agoMerge #5008
bors[bot] [Tue, 23 Jun 2020 21:47:00 +0000 (21:47 +0000)]
Merge #5008

5008: Remove useless test code r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove useless test code
Aleksey Kladov [Tue, 23 Jun 2020 11:20:53 +0000 (13:20 +0200)]
Remove useless test code

4 years agoMerge #5013
bors[bot] [Tue, 23 Jun 2020 21:34:12 +0000 (21:34 +0000)]
Merge #5013

5013: More principled indentation trimming in fixtures r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMore principled indentation trimming in fixtures
Aleksey Kladov [Tue, 23 Jun 2020 20:27:24 +0000 (22:27 +0200)]
More principled indentation trimming in fixtures

4 years agoMinor, rename
Aleksey Kladov [Tue, 23 Jun 2020 19:45:40 +0000 (21:45 +0200)]
Minor, rename

4 years agoMerge #5012
bors[bot] [Tue, 23 Jun 2020 19:30:28 +0000 (19:30 +0000)]
Merge #5012

5012: Slightly better name r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSlightly better name
Aleksey Kladov [Tue, 23 Jun 2020 19:29:50 +0000 (21:29 +0200)]
Slightly better name

4 years agoMerge #5011
bors[bot] [Tue, 23 Jun 2020 18:39:58 +0000 (18:39 +0000)]
Merge #5011

5011: Simplify fixtures r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoComplicate
Aleksey Kladov [Tue, 23 Jun 2020 18:38:36 +0000 (20:38 +0200)]
Complicate

Fixing test fallout unfortunately requires more work, we need to do
it, but let's merge something at least!

4 years agoDocs for Fixture
Aleksey Kladov [Tue, 23 Jun 2020 16:58:45 +0000 (18:58 +0200)]
Docs for Fixture

4 years agoCut problematic dependency
Aleksey Kladov [Tue, 23 Jun 2020 16:56:26 +0000 (18:56 +0200)]
Cut problematic dependency

4 years agoNicer API
Aleksey Kladov [Tue, 23 Jun 2020 16:46:56 +0000 (18:46 +0200)]
Nicer API

4 years agoSimplify
Aleksey Kladov [Tue, 23 Jun 2020 16:43:55 +0000 (18:43 +0200)]
Simplify

4 years agoSimplify
Aleksey Kladov [Tue, 23 Jun 2020 16:34:50 +0000 (18:34 +0200)]
Simplify

4 years agoSimplify
Aleksey Kladov [Tue, 23 Jun 2020 16:20:32 +0000 (18:20 +0200)]
Simplify

4 years agoDrop rarely used fixture functionality
Aleksey Kladov [Tue, 23 Jun 2020 16:17:43 +0000 (18:17 +0200)]
Drop rarely used fixture functionality

4 years agoMove fixtures to a separate file
Aleksey Kladov [Tue, 23 Jun 2020 15:59:56 +0000 (17:59 +0200)]
Move fixtures to a separate file

4 years agoMerge #4976
bors[bot] [Tue, 23 Jun 2020 15:53:56 +0000 (15:53 +0000)]
Merge #4976

4976: New VFS r=matklad a=matklad

Still a draft, but mostly working already.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoNew VFS
Aleksey Kladov [Thu, 11 Jun 2020 09:04:09 +0000 (11:04 +0200)]
New VFS

4 years agoMerge #5010
bors[bot] [Tue, 23 Jun 2020 15:04:42 +0000 (15:04 +0000)]
Merge #5010

5010: Remove relative-path dependency r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove relative-path dependency
Aleksey Kladov [Tue, 23 Jun 2020 15:01:44 +0000 (17:01 +0200)]
Remove relative-path dependency

4 years agoMerge #5004
bors[bot] [Tue, 23 Jun 2020 14:55:03 +0000 (14:55 +0000)]
Merge #5004

5004: Fix panic in split/merge import assists r=matklad a=lnicola

Fixes #4368 #4905

Not sure if this is the best solution here. Maybe the `make` functions should be fallible? We generally seem to be playing whack-a-mole with panics in assists, although most of them are `unwrap`s in the assist code.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
4 years agoFix panic in split and merge import assists
Laurențiu Nicola [Tue, 23 Jun 2020 06:41:43 +0000 (09:41 +0300)]
Fix panic in split and merge import assists

4 years agoMerge #5002
bors[bot] [Tue, 23 Jun 2020 13:25:43 +0000 (13:25 +0000)]
Merge #5002

5002: Fix underflow panic when doctests are at top of file r=Nashenas88 a=Nashenas88

While debugging a comment at the top of a test string, I discovered that the offset calculations could underflow and panic. This only seemed to occur in tests, I assume because it's running a debug mode. The wrapping is quickly fixed later on in release mode, which is why this seems to have gone unnoticed. The new checks ensure the value is always positive or zero.

Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
4 years agoMerge #4992 #4993 #4994 #4997 #4998
bors[bot] [Tue, 23 Jun 2020 10:09:58 +0000 (10:09 +0000)]
Merge #4992 #4993 #4994 #4997 #4998

4992: Never disable error logging on the frontend r=matklad a=Veetaha

4993: Make bootstrap error message more informative and better-fitting r=matklad a=Veetaha

Now this better fits standard vscode extension activation failure message and suggests enabling verbose logs.

![image](https://user-images.githubusercontent.com/36276403/85321828-ffbb9400-b4cd-11ea-8adf-4032b1f62dfd.png)

4994: Decouple http file stream logic from temp dir logic r=matklad a=Veetaha

Followup for #4989

4997: Update manual.adoc r=matklad a=gwutz

GNOME Builder (Nightly) supports now rust-analyzer

4998: Disrecommend trace.server: "verbose" for regular users r=matklad a=Veetaha

This option has never been useful for me, I wonder if anyone finds regular users can use this for sending logs

Co-authored-by: Veetaha <veetaha2@gmail.com>
Co-authored-by: Günther Wagner <info@gunibert.de>
4 years agoMerge #4999
bors[bot] [Tue, 23 Jun 2020 10:02:59 +0000 (10:02 +0000)]
Merge #4999

4999: SSR: Allow matching of whole macro calls r=matklad a=davidlattimore

Matching within macro calls is to come later and matching of macro calls within macro calls later still.

Co-authored-by: David Lattimore <dml@google.com>
4 years agoUpdate docs/user/manual.adoc
Günther Wagner [Tue, 23 Jun 2020 05:18:46 +0000 (07:18 +0200)]
Update docs/user/manual.adoc

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
4 years agoFix underflow panic when doctests are at top of file
Paul Daniel Faria [Tue, 23 Jun 2020 02:28:09 +0000 (22:28 -0400)]
Fix underflow panic when doctests are at top of file

4 years agoMerge #5000
bors[bot] [Mon, 22 Jun 2020 22:15:22 +0000 (22:15 +0000)]
Merge #5000

5000: Remove RelativePathBuf from fixture r=matklad a=matklad

The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove RelativePathBuf from fixture
Aleksey Kladov [Mon, 22 Jun 2020 15:30:23 +0000 (17:30 +0200)]
Remove RelativePathBuf from fixture

The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.

4 years agoSSR: Allow matching of whole macro calls
David Lattimore [Mon, 22 Jun 2020 08:15:51 +0000 (18:15 +1000)]
SSR: Allow matching of whole macro calls

Matching within macro calls is to come later and matching of macro calls within macro calls later still.

4 years agoDisrecommend trace.server: "verbose" for regular users
Veetaha [Mon, 22 Jun 2020 20:57:36 +0000 (23:57 +0300)]
Disrecommend trace.server: "verbose" for regular users

4 years agoUpdate manual.adoc
Günther Wagner [Mon, 22 Jun 2020 20:38:43 +0000 (22:38 +0200)]
Update manual.adoc

GNOME Builder (Nightly) supports now rust-analyzer

4 years agoDecouple http file stream logic from temp dir logic
Veetaha [Mon, 22 Jun 2020 18:36:56 +0000 (21:36 +0300)]
Decouple http file stream logic from temp dir logic

4 years agoNever disable error logging on the frontend
Veetaha [Mon, 22 Jun 2020 17:53:17 +0000 (20:53 +0300)]
Never disable error logging on the frontend

4 years agoMake bootstrap error message more informative and better-fitting
Veetaha [Mon, 22 Jun 2020 18:18:36 +0000 (21:18 +0300)]
Make bootstrap error message more informative and better-fitting

4 years agoMerge #4989
bors[bot] [Mon, 22 Jun 2020 17:25:03 +0000 (17:25 +0000)]
Merge #4989

4989: Hotfix skipping the first chunks of the artifacts r=matklad a=Veetaha

Quick hotfix.
fixes: #4986, #4987

The stream starts being consumed once we put a handler for `data` event.
When extracting `stream.pipeline()` under `withTempFile` in #4963 I didn't move it into the scope too, which due to preliminary awaiting for async operations with the file system allowed for the first chunks of the file to be skipped

Co-authored-by: Veetaha <veetaha2@gmail.com>
4 years agoHotfix skipping the first chunks of the artifacts
Veetaha [Mon, 22 Jun 2020 16:50:57 +0000 (19:50 +0300)]
Hotfix skipping the first chunks of the artifacts

4 years agoMerge #4988
bors[bot] [Mon, 22 Jun 2020 15:47:22 +0000 (15:47 +0000)]
Merge #4988

4988: Don't offer to add missing fields of unknown types r=flodiebold a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
4 years agoDon't offer to add missing fields of unknown types
Laurențiu Nicola [Mon, 22 Jun 2020 15:16:00 +0000 (18:16 +0300)]
Don't offer to add missing fields of unknown types

4 years agoMerge #4900
bors[bot] [Mon, 22 Jun 2020 14:37:45 +0000 (14:37 +0000)]
Merge #4900

4900: Self variant enum res fix r=BGluth a=BGluth

Fixes #4789.

This is my first PR for this project, so it's probably worth giving it an extra close look.

A few things that I wasn't sure about:
- Is `resolve_path` really the best place to perform this check? It seemed like a natural place, but perhaps there's a better place?
- When handling the new variant `PathResolution::VariantDef`, I couldn't see an obvious variant of `TypeNs` to return in `in_type_ns` for Unions and Structs.

Co-authored-by: BGluth <gluthb@gmail.com>
4 years agoEnum variants with `Self::[variant]` now resolve (#4879)
BGluth [Mon, 15 Jun 2020 20:30:25 +0000 (14:30 -0600)]
Enum variants with `Self::[variant]` now resolve (#4879)

4 years agoMerge #4984
bors[bot] [Mon, 22 Jun 2020 13:11:50 +0000 (13:11 +0000)]
Merge #4984

4984: Add sponsors section to changelog r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoAdd sponsors section to changelog
Aleksey Kladov [Mon, 22 Jun 2020 13:11:22 +0000 (15:11 +0200)]
Add sponsors section to changelog

4 years agoMerge #4983
bors[bot] [Mon, 22 Jun 2020 13:04:16 +0000 (13:04 +0000)]
Merge #4983

4983: Add paths::RelPath[Buf] r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoAdd paths::RelPath[Buf]
Aleksey Kladov [Mon, 22 Jun 2020 13:03:37 +0000 (15:03 +0200)]
Add paths::RelPath[Buf]

4 years agoMerge #4899
bors[bot] [Mon, 22 Jun 2020 12:13:18 +0000 (12:13 +0000)]
Merge #4899

4899: don't complete top level attrs inside nested attrs and add better labels r=matklad a=bnjjj

close #4890

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4921
bors[bot] [Mon, 22 Jun 2020 11:50:34 +0000 (11:50 +0000)]
Merge #4921

4921: Allow SSR to match type references, items, paths and patterns r=davidlattimore a=davidlattimore

Part of #3186

Co-authored-by: David Lattimore <dml@google.com>
4 years agoAllow SSR to match type references, items, paths and patterns
David Lattimore [Wed, 17 Jun 2020 06:53:51 +0000 (16:53 +1000)]
Allow SSR to match type references, items, paths and patterns

Part of #3186

4 years agodon't complete top level attrs inside nested attrs and add better labels #4899
Benjamin Coenen [Mon, 22 Jun 2020 11:39:05 +0000 (13:39 +0200)]
don't complete top level attrs inside nested attrs and add better labels #4899

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4928
bors[bot] [Mon, 22 Jun 2020 11:19:09 +0000 (11:19 +0000)]
Merge #4928

4928: Fix renaming mod in use tree r=matklad a=unexge

Fixes #4825

Co-authored-by: unexge <unexge@gmail.com>
4 years agoCreated goto Self enum variant test
BGluth [Wed, 10 Jun 2020 17:11:47 +0000 (11:11 -0600)]
Created goto Self enum variant test

4 years agodon't complete top level attrs inside nested attrs and add better labels #4899
Benjamin Coenen [Sun, 21 Jun 2020 17:14:08 +0000 (19:14 +0200)]
don't complete top level attrs inside nested attrs and add better labels #4899

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4971
bors[bot] [Sun, 21 Jun 2020 16:11:41 +0000 (16:11 +0000)]
Merge #4971

4971: cargo update r=kjeremy a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoUpdate test for new serde
Jeremy Kolb [Sun, 21 Jun 2020 16:10:50 +0000 (12:10 -0400)]
Update test for new serde

4 years agocargo update
Jeremy Kolb [Sun, 21 Jun 2020 15:53:52 +0000 (11:53 -0400)]
cargo update

4 years agoMerge #4969
bors[bot] [Sun, 21 Jun 2020 14:24:51 +0000 (14:24 +0000)]
Merge #4969

4969: Handle bindings after @ in patterns r=flodiebold a=jonas-schievink

This is unstable, behind the `bindings_after_at` feature gate, but the semantics are fairly clear, and this is used at lot in rustc.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoHandle bindings after @ in patterns
Jonas Schievink [Sun, 21 Jun 2020 13:18:10 +0000 (15:18 +0200)]
Handle bindings after @ in patterns

4 years agoMerge #4962
bors[bot] [Sun, 21 Jun 2020 12:37:29 +0000 (12:37 +0000)]
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>
4 years agoImplement APIs for parsing expressions, types, paths, patterns and items
David Lattimore [Thu, 18 Jun 2020 21:43:19 +0000 (07:43 +1000)]
Implement APIs for parsing expressions, types, paths, patterns and items

4 years agoMerge #4959
bors[bot] [Sun, 21 Jun 2020 12:05:16 +0000 (12:05 +0000)]
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>
4 years agoMerge #4963
bors[bot] [Sun, 21 Jun 2020 09:26:47 +0000 (09:26 +0000)]
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>
4 years agoMerge #4947
bors[bot] [Sat, 20 Jun 2020 22:14:21 +0000 (22:14 +0000)]
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>
4 years agoMerge #4964
bors[bot] [Sat, 20 Jun 2020 21:24:54 +0000 (21:24 +0000)]
Merge #4964

4964: Move ReqQueue to lsp-server r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMove ReqQueue to lsp-server
Aleksey Kladov [Sat, 20 Jun 2020 21:08:01 +0000 (23:08 +0200)]
Move ReqQueue to lsp-server

4 years agoMerge #4961
bors[bot] [Sat, 20 Jun 2020 19:39:41 +0000 (19:39 +0000)]
Merge #4961

4961: Centralize handing of in-flight requests r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMerge #4958
bors[bot] [Sat, 20 Jun 2020 15:10:35 +0000 (15:10 +0000)]
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>
4 years agoPush obligation instead of matching on solution
adamrk [Sat, 20 Jun 2020 15:00:57 +0000 (17:00 +0200)]
Push obligation instead of matching on solution

4 years agoDownload artifacts into tmp dir
Veetaha [Sat, 20 Jun 2020 12:38:08 +0000 (15:38 +0300)]
Download artifacts into tmp dir

4 years agoCentralize handing of in-flight requests
Aleksey Kladov [Sat, 20 Jun 2020 11:06:11 +0000 (13:06 +0200)]
Centralize handing of in-flight requests

4 years agoGet Output assoc type by name
adamrk [Sat, 20 Jun 2020 09:53:55 +0000 (11:53 +0200)]
Get Output assoc type by name

4 years agoAdd test for dyn Fn Output
adamrk [Sat, 20 Jun 2020 09:43:40 +0000 (11:43 +0200)]
Add test for dyn Fn Output

4 years agomove tests to ra_hir_ty
adamrk [Sat, 20 Jun 2020 09:32:01 +0000 (11:32 +0200)]
move tests to ra_hir_ty

4 years agoFixes to callable_sig_from_fn_trait
adamrk [Sat, 20 Jun 2020 09:04:46 +0000 (11:04 +0200)]
Fixes to callable_sig_from_fn_trait

4 years agoMake get_fn_trait a method of FnTrait
adamrk [Sat, 20 Jun 2020 06:42:35 +0000 (08:42 +0200)]
Make get_fn_trait a method of FnTrait

4 years agoSwitch back callable_sig for known fn types
adamrk [Sat, 20 Jun 2020 06:13:14 +0000 (08:13 +0200)]
Switch back callable_sig for known fn types

4 years agoRecursively compute impl sets
Jonas Schievink [Fri, 19 Jun 2020 22:36:02 +0000 (00:36 +0200)]
Recursively compute impl sets

4 years agoSyntax highlighting for documentation comments on macro definitions
Leander Tentrup [Fri, 19 Jun 2020 22:02:42 +0000 (00:02 +0200)]
Syntax highlighting for documentation comments on macro definitions

4 years agoMerge #4952
bors[bot] [Fri, 19 Jun 2020 21:40:59 +0000 (21:40 +0000)]
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>
4 years agoMerge #4951
bors[bot] [Fri, 19 Jun 2020 21:28:32 +0000 (21:28 +0000)]
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>
4 years agoMerge #4955
bors[bot] [Fri, 19 Jun 2020 21:18:18 +0000 (21:18 +0000)]
Merge #4955

4955: Update workaround comment r=matklad a=Veetaha

Co-authored-by: Veetaha <veetaha2@gmail.com>
4 years agoAdd new query to stats
Jonas Schievink [Fri, 19 Jun 2020 21:17:53 +0000 (23:17 +0200)]
Add new query to stats

4 years agoInfer FnSig from Fn traits
adamrk [Sun, 7 Jun 2020 19:57:29 +0000 (21:57 +0200)]
Infer FnSig from Fn traits

4 years agoDon't include downstream crate in query
Jonas Schievink [Fri, 19 Jun 2020 20:33:13 +0000 (22:33 +0200)]
Don't include downstream crate in query

4 years agoShift bound variables correctly when using assoc type shorthand
Florian Diebold [Fri, 19 Jun 2020 16:32:42 +0000 (18:32 +0200)]
Shift bound variables correctly when using assoc type shorthand

Fixes #4885.
Fixes #4800.

4 years agoMerge #4950
bors[bot] [Fri, 19 Jun 2020 19:47:30 +0000 (19:47 +0000)]
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>
4 years agoUse correct substs for super trait assoc types
Florian Diebold [Fri, 19 Jun 2020 14:29:38 +0000 (16:29 +0200)]
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.

4 years agoMerge #4957
bors[bot] [Fri, 19 Jun 2020 18:48:06 +0000 (18:48 +0000)]
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>
4 years agoFix substs in resolve_value_path for ImplSelf
Vincent Rouillé [Fri, 19 Jun 2020 18:33:04 +0000 (20:33 +0200)]
Fix substs in resolve_value_path for ImplSelf

Fixes #4953.

4 years agoUpdate workaround comment
Veetaha [Fri, 19 Jun 2020 17:52:06 +0000 (20:52 +0300)]
Update workaround comment

4 years agoDon't panic on crates depending on themselves
Florian Diebold [Fri, 19 Jun 2020 16:02:54 +0000 (18:02 +0200)]
Don't panic on crates depending on themselves

Fixes #3883.

4 years agoMerge #4851
bors[bot] [Fri, 19 Jun 2020 15:08:52 +0000 (15:08 +0000)]
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>
4 years agoMerge #4937
bors[bot] [Fri, 19 Jun 2020 13:43:42 +0000 (13:43 +0000)]
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>
4 years agoMerge #4839
bors[bot] [Fri, 19 Jun 2020 13:34:24 +0000 (13:34 +0000)]
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>
4 years agoMerge #4948
bors[bot] [Fri, 19 Jun 2020 13:10:52 +0000 (13:10 +0000)]
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>
4 years agoSpeedup VFS::partition
Aleksey Kladov [Fri, 19 Jun 2020 13:07:32 +0000 (15:07 +0200)]
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.

4 years agoReplace `impls_in_trait` with `CrateImplDefs`
Jonas Schievink [Thu, 18 Jun 2020 23:29:34 +0000 (01:29 +0200)]
Replace `impls_in_trait` with `CrateImplDefs`

4 years agoMerge #4930
bors[bot] [Thu, 18 Jun 2020 19:43:05 +0000 (19:43 +0000)]
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>
4 years agodon't complete top level attrs inside nested attrs and add better labels #4890
Benjamin Coenen [Thu, 18 Jun 2020 19:31:49 +0000 (21:31 +0200)]
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>