Commit Graph

23413 Commits

Author SHA1 Message Date
Lukas Wirth ee2dd934ca Don't trigger adjustment hints in all inlay hint tests 2022-11-07 12:49:52 +01:00
Lukas Wirth d841ad116a Fix up adjustment hints configurations 2022-11-04 22:59:07 +01:00
Lukas Wirth 95d20fccd7 Add adjustment hint tests 2022-11-04 22:40:06 +01:00
Lukas Wirth c98fc537e6 Generalize reborrow hints as adjustment hints 2022-11-04 21:53:23 +01:00
bors cd2603299c Auto merge of #13546 - Veykril:unsafe-fn-ptr, r=Veykril
Lower unsafety of fn pointer and fn item types
2022-11-04 20:29:16 +00:00
Lukas Wirth 6f09c72b1b Lower unsafety of fn pointer and fn item types 2022-11-04 21:07:15 +01:00
bors ad633db493 Auto merge of #13544 - HKalbasi:patch-2, r=Veykril
Add rustbot features related to PR state labels

It makes rustbot add `S-waiting-on-review` to every new PR, and ``@rustbot` author` and ``@rustbot` review` commands working.
2022-11-04 16:12:21 +00:00
HKalbasi 3508820a14 Add rustbot features related to PR state labels 2022-11-04 15:27:50 +03:30
bors bbcb77ea6f Auto merge of #13456 - emilio:scip-local-symbol, r=Veykril
scip: Generate symbols for local crates.

Consider something like:

```
// a.rs
pub struct Foo { .. } // Foo is "local 1"

fn something() {
    crate::b::Bar::new() // Bar is "local 1", but of "b.rs"
}

// b.rs
pub struct Bar { .. } // "local 1"
```

Without this there's no way to disambiguate whether "local 1" references "Bar" or "Foo".
2022-11-03 13:58:36 +00:00
bors f3a68712a9 Auto merge of #13537 - lnicola:ovsx-fail, r=lnicola
minor: Allow ovsx publishing to fail
2022-11-03 13:43:38 +00:00
Laurențiu Nicola 6073e58e30 Allow ovsx publishing to fail 2022-11-03 15:42:55 +02: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](https://github.com/rust-lang/rust-analyzer/blob/ba28e19b7838e3ad4223ae82d074dc3950ef1548/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](https://github.com/rust-lang/rust-analyzer/blob/8142d1f606dc2e52b1d2b8992671e2bd73379f28/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