Commit graph

23402 commits

Author SHA1 Message Date
Rongjian Zhang
08c2b4557b docs: add crates section to the manual 2022-11-03 13:17:06 +08:00
bors
56c97a8351 Auto merge of #13530 - lnicola:bump-ovsx, r=lnicola
minor: Bump ovsx

CC https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/1330#note_1033611
2022-11-02 13:11:55 +00:00
Laurențiu Nicola
adee109376 Bump ovsx 2022-11-02 14:51:07 +02:00
bors
6c3ab563de Auto merge of #13527 - unexge:use-let-else-stmt-in-convert-to-guarded-return-assist, r=jonas-schievink
Use let-else statements in `Convert to guarded return` assist

Follow up for https://github.com/rust-lang/rust-analyzer/pull/13516, addresses remaining part of https://github.com/rust-lang/rust-analyzer/issues/13254#issuecomment-1250408527
2022-11-02 11:06:54 +00:00
bors
af1f48deab Auto merge of #13359 - feniljain:feat-must-use-option, r=Veykril
feat: add config for inserting must_use in `generate_enum_as_method`

Should fix #13312

Didn't add a test because I was not sure on how to add test for a specific configuration option, tried to look for the usages for other `AssistConfig` variants but couldn't find any in `tests`. If there is a way to test this, do point me towards it.

I tried to extract the formatting string as a common `template_string` and only have if-else for that, but it didn't compile :(

Also it seems these tests are failing:

```
test config::tests::generate_config_documentation ... FAILED
test config::tests::generate_package_json_config ... FAILED
```

Can you also point me to how to correct these 😅  ( I guess there is some command to automatically generate these? )
2022-11-02 10:50:08 +00:00
feniljain
691ce306df
fix: indentation after inserting #must_use
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-11-02 16:09:12 +05:30
bors
12ced8f9db Auto merge of #13517 - feniljain:fix_completions, r=Veykril
fix: make custom expr prefix completions to understand refs

Possible fix of #7929

While reviewing the postfix completion code I saw that while calling `add_custom_postfix_completions` we were doing it under the part where reference was not taken into consideration, but as we are only adding postfix completions with `Expr` scope ( [source](ba28e19b78/crates/ide-completion/src/completions/postfix.rs (L272)) )

I shifted the `add_custom_postfix_completions` call to part where references are considered

I am not sure if this is the correct fix or I am understanding the problem exactly but this small move seemed to have fixed the issue :)
2022-11-02 10:15:18 +00:00
unexge
62a6cdfe46 Use let-else statements in Convert to guarded return assist 2022-11-01 23:02:10 +00:00
bors
c1305fa5d9 Auto merge of #13525 - jonas-schievink:generic-call-signature, r=jonas-schievink
feat: show signature help when calling generic types implementing `FnOnce`

This queries chalk for the `FnOnce` impl of callees and takes argument and return types from there, making generic `Callable`s available to the IDE. This makes signature help work for them, and potentially allows other features to take generic callables into account in the future.
2022-11-01 17:01:07 +00:00
bors
a8e97bcf3c Auto merge of #13508 - koka831:fix/13492, r=jonas-schievink
fix: async trait method for `unnecessary_async`

Fix https://github.com/rust-lang/rust-analyzer/issues/13492
2022-11-01 16:38:40 +00:00
bors
d90cb1e772 Auto merge of #13516 - unexge:add-convert-match-to-let-else-assist, r=jonas-schievink
Add `Convert match to let-else` assist

Closes https://github.com/rust-lang/rust-analyzer/issues/13254
2022-11-01 16:24:15 +00:00
Jonas Schievink
72d5b456e1 Fix doc test 2022-11-01 17:23:32 +01:00
Jonas Schievink
e110c7889a Revert "Record diverging match arms in InferenceResult"
This reverts commit 319611b738.
2022-11-01 17:18:17 +01:00
Jonas Schievink
9f1bb17a1b Import option in the tests 2022-11-01 17:18:13 +01:00
Jonas Schievink
ecad1a9a6e Create Callables for generic types implementing FnOnce 2022-11-01 16:38:19 +01:00
bors
07f6efc4e7 Auto merge of #13523 - lowr:fix/adjust-expectation-for-if, r=lnicola
fix: disregard type variable expectation for if expressions

Fixes #13522

As [the comment](8142d1f606/crates/hir-ty/src/infer.rs (L1087-L1090)) on `Expectation::adjust_for_branches` explains:

> If the expected type is just a type variable, then don't use an expected type. Otherwise, we might write parts of the type when checking the 'then' block which are incompatible with the 'else' branch.

Note that we already use it in match expressions. I've added tests for them too nevertheless.
2022-10-31 15:39:20 +00:00
Ryo Yoshida
db8c7523f8
fix: disregard type variable expectation for if expressions 2022-11-01 00:15:05 +09:00
bors
8142d1f606 Auto merge of #13445 - notJoon:modify-dead-links, r=lnicola
fix) update broken links in guide.md

Hi, I Just fixed some broken links in `guide.md`.

In most cases, it is not connected by an old version (expecially `guide-2019-01`) of the link, so I made some modifications.

Thanks for your time :)
2022-10-31 06:55:11 +00:00
feniljain
98125b9f95 fix: make custom expr prefix completions to understand refs 2022-10-30 15:02:17 +05:30
unexge
f0a14346ee Update auto generated tests 2022-10-30 00:00:53 +01:00
unexge
48efc9d303 Add Convert match to let-else assist 2022-10-29 23:45:13 +01:00
unexge
319611b738 Record diverging match arms in InferenceResult 2022-10-29 23:44:34 +01:00
koka
cf90e4f32b
Simplify the procedure
fix: remove unused import
2022-10-30 00:59:20 +09:00
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
koka
4a7f5cac9d
fix: async trait method for unnecessary_async 2022-10-29 01:14:44 +09: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
feniljain
4bf9b9b003 refactor: remove repetitive string interpolation and doc changes 2022-10-24 21:12:31 +05:30
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