Commit Graph

23375 Commits

Author SHA1 Message Date
bors
ba28e19b78 Auto merge of #13505 - lowr:feat/gats, r=flodiebold
Clean up tests and add documentation for GATs related stuff

This is a follow-up PR for #13494.

- addresses https://github.com/rust-lang/rust-analyzer/pull/13494#discussion_r1006774897
- documents the ordering constraint on `Binders` and `Substitution` (which is not really follow-up for the previous PR, but it was introduced to support GATs and I strongly feel it's worth it)
2022-10-29 08:54:14 +00:00
bors
ebce5e923c Auto merge of #13513 - Veykril:vscode-workspace-changes, r=Veykril
Properly handle vscode workspace changes
2022-10-28 23:41:22 +00:00
Lukas Wirth
fccf8eb1fd Properly handle vscode workspace changes 2022-10-29 01:41:02 +02:00
bors
7610ee9139 Auto merge of #13512 - Veykril:startup-commands, r=Veykril
Always set up VSCode commands
2022-10-28 22:51:52 +00:00
Lukas Wirth
2071d00fd2 Always set up VSCode commands 2022-10-29 00:44:37 +02:00
bors
e69014a81e Auto merge of #13510 - Veykril:status-click, r=Veykril
feat: Clicking the status bar item stops and starts the server
2022-10-28 21:12:27 +00:00
Lukas Wirth
274df54885 feat: Clicking the status bar item stops and starts the server 2022-10-28 23:10:10 +02:00
Ryo Yoshida
e0f09cd007
Document the ordering constraint on Binders and Substitution 2022-10-28 21:24:59 +09:00
Ryo Yoshida
5c794210bf
Replace expect test for GATs with check_types 2022-10-28 21:24:55 +09:00
bors
d022e0ec53 Auto merge of #13496 - rust-lang:lnicola-patch-1, r=jonas-schievink
internal: Clarify feature policy

CC #13495
2022-10-27 13:37:45 +00:00
Laurențiu Nicola
05514d8233
Clarify feature policy 2022-10-27 16:35:07 +03:00
bors
c6e1e17a10 Auto merge of #13494 - lowr:feat/gats, r=flodiebold
feat: type inference for generic associated types

This PR implements type inference for generic associated types. Basically, this PR lowers generic arguments for associated types in valid places and creates `Substitution`s for them.

I focused on the inference for correct Rust programs, so there are cases where we *accidentally* manage to infer things that are actually invalid (which would then be reported by flycheck so I deem them non-fatal). See the following tests and FIXME notes on them: `gats_with_dyn`, `gats_with_impl_trait`.

The added tests are rather arbitrary. Let me know if there are cases I'm missing or I should add.

Closes #9673
2022-10-27 12:37:50 +00:00
Ryo Yoshida
5fc18ad6fa
Lower generic arguments for GATs in associated type bindings 2022-10-27 19:19:01 +09:00
Ryo Yoshida
63cba43b48
Collect generic arguments in associated type bindings 2022-10-27 19:18:59 +09:00
Ryo Yoshida
f233ac447f
Lower generic arguments for associated types in paths 2022-10-27 19:18:57 +09:00
Ryo Yoshida
4dd694371a
Display generic arguments for associated types 2022-10-27 19:18:55 +09:00
Ryo Yoshida
1fe10bff1d
refactor: remove obsolete code 2022-10-27 19:18:51 +09:00
bors
0340b51ff7 Auto merge of #13484 - lnicola:position-encoding, r=lnicola
Switch to upstream `positionEncoding`

Closes #13481

This drops support for the custom extension, but that's probably fine.

Draft because it's not tested yet.
2022-10-26 18:12:47 +00:00
bors
feefbe7918 Auto merge of #13475 - lowr:fix/lookup-impl-method-trait-ref, r=flodiebold
fix: Test all generic args for trait when finding matching impl

Addresses https://github.com/rust-lang/rust-analyzer/pull/13463#issuecomment-1287816680

When finding matching impl for a trait method, we've been testing the unifiability of self type. However, there can be multiple impl of a trait for the same type with different generic arguments for the trait. This patch takes it into account and tests the unifiability of all type arguments for the trait (the first being the self type) thus enables rust-analyzer to find the correct impl even in such cases.
2022-10-26 12:06:26 +00:00
Ryo Yoshida
67f1d8fe2c
Test all generic args for trait when finding matching impl 2022-10-25 23:28:40 +09:00
Laurențiu Nicola
e93a2bff67 Pin lsp-types 2022-10-25 15:03:35 +03:00
Laurențiu Nicola
956b96a19d Switch to upstream positionEncoding 2022-10-25 14:43:26 +03:00
Ryo Yoshida
15d4383053
Let InferenceTable::unify() relate Zip values 2022-10-24 23:28:53 +09:00
bors
53b6d69e93 Auto merge of #13478 - Veykril:fix-flycheck, r=Veykril
fix: Fix standard flycheck command not being executed in the workspace it is being invoked for

Fixes https://github.com/rust-lang/rust-analyzer/issues/13477
2022-10-24 14:08:45 +00:00
Lukas Wirth
fbae83acd0 fix: Fix standard flycheck command not being executed in the workspace it is being invoked for 2022-10-24 16:07:42 +02:00
bors
98aa678dc5 Auto merge of #13476 - Veykril:prefer-shutdown, r=Veykril
fix: Don't respond with an error when requesting a shutdown while starting
2022-10-24 13:08:22 +00:00
Lukas Wirth
6a00e14c7a fix: Don't respond with an error when requesting a shutdown while starting 2022-10-24 14:56:58 +02:00
Ryo Yoshida
6afd0f57eb
Refactor: unwrap Option once in the beginning of closure 2022-10-24 21:30:31 +09:00
bors
43fb9563b2 Auto merge of #13471 - Veykril:invoc-strategy-once, r=Veykril
Handle multiple projects sharing dependency correctly in `once` strategy
2022-10-23 16:02:07 +00:00
Lukas Wirth
859f5594ac Handle multiple projects sharing dependency correctly in once strategy 2022-10-23 18:01:35 +02:00
bors
b25f65739a Auto merge of #13466 - Veykril:invocation-location, r=Veykril
Implement invocation location config

This allows setting the working directory for build-scripts on flycheck
Complements https://github.com/rust-lang/rust-analyzer/pull/13128

This will be followed up by one more PR that adds a few simple interpolation vars for `overrideCommand`, with that we should cover the needs for most build systems I believe.
2022-10-22 21:52:04 +00:00
Lukas Wirth
0f8904ec9c Implement invocation location config 2022-10-22 23:33:03 +02:00
bors
19efa0b110 Auto merge of #13463 - lowr:fix/builtin-derive-with-const-generics, r=Veykril
Support const generics for builtin derive macro

Fixes #13121

We have been treating every generic parameter as type parameter during builtin derive macro expansion. This patch adds support for const generics in such expansions.
2022-10-22 15:49:00 +00:00
Ryo Yoshida
6459d7f817
Support const generics for builtin derive macro 2022-10-23 00:05:22 +09:00
bors
d3b7e94d0a Auto merge of #13460 - emilio:scip-cleanups, r=Veykril
scip: minor clean-ups

Avoids a couple redundant hash map lookups and so.
2022-10-22 13:46:23 +00:00
bors
b643dd6ea6 Auto merge of #13461 - emilio:ide-cleanup-continue, r=Veykril
ide: Remove unnecessary continue.

Just a minor clean-up I found while going through the code.
2022-10-22 13:29:58 +00:00
Emilio Cobos Álvarez
ec6d72baa1
scip: Rewrite tests to be closer to what we actually do.
It's also less code.
2022-10-22 15:21:31 +02:00
Emilio Cobos Álvarez
bd49d01906
ide: Remove unnecessary continue. 2022-10-22 15:15:10 +02:00
Emilio Cobos Álvarez
7ee72256eb
scip: minor clean-ups
Avoids a couple redundant hash map lookups and so.
2022-10-22 14:14:43 +02:00
bors
8ee23f4f0a Auto merge of #13453 - Veykril:disabled-commands, r=Veykril
internal: Properly handle commands in the VSCode client when the server is stopped
2022-10-21 14:05:25 +00:00
Lukas Wirth
1cb46079e4 internal: Properly handle commands in the VSCode client when the server is stopped 2022-10-21 16:00:43 +02:00
bors
69f01fdff5 Auto merge of #13451 - Veykril:lang-config, r=Veykril
internal: Properly handle language configuration config changes
2022-10-20 19:15:30 +00:00
Lukas Wirth
a8e0a20ce4 internal: Properly handle language configuration config changes 2022-10-20 21:14:36 +02:00
bors
2481721211 Auto merge of #13447 - Veykril:didsavedoc-block, r=Veykril
fix: Fix DidSaveDocument requests blocking the server on startup

Follow up to https://github.com/rust-lang/rust-analyzer/pull/13428
Fixes https://github.com/rust-lang/rust-analyzer/issues/13434
2022-10-20 18:13:09 +00:00
bors
7741e3dc73 Auto merge of #13448 - yotamofek:python-ext-polyfill-workaround, r=Veykril
Workaround the python vscode extension's polyfill

Fixes #13442

`String.replaceAll` and `String.replace` behave the same when given a (/g-flagged) Regex, so fix is very simple.
2022-10-20 17:59:14 +00:00
Yotam Ofek
e05df93b8e Workaround the python vscode extension's polyfill 2022-10-20 17:56:51 +00:00
Lukas Wirth
de195ff97c fix: Fix DidSaveDocument requests blocking the server on startup 2022-10-20 19:55:04 +02:00
bors
f3cce5feea Auto merge of #13365 - feniljain:master, r=Veykril
feat: add multiple getters mode in `generate_getter`

This commit adds two modes to generate_getter action.
First, the plain old working on single fields.
Second, working on a selected range of fields.

Should partially solve #13246
If this gets approved will create a separate PR for setters version of the same

### Points to help in review:

- `generate_getter_from_record_info` contains code which is mostly taken from assist before refactor
- Same goes for `parse_record_fields`
- There are changes in other assists, as one of the methods in utils named `find_struct_impl` is changed, before it used to accept a single `fn_name`, now it takes a list of function names to check against. All old impls are updated to create a small list to pass their single element.

### Assumptions:

- If any of the fields have an implementation, the action will quit.
2022-10-20 12:07:28 +00:00
feniljain
5bff6c55de feat: add multiple getters mode in generate_getter
This commit adds two modes to generate_getter action.
First, the plain old working on single fields.
Second, working on a selected range of fields.
2022-10-20 16:47:23 +05:30
bors
32614e27fb Auto merge of #13444 - Veykril:rethrow-err, r=Veykril
fix: Don't catch the server activation error

We are are rethrowing and showing errors higher up in the call stack already. This just ate the error hiding the stacktrace unnecessarily.
2022-10-20 09:34:06 +00:00