Commit Graph

24724 Commits

Author SHA1 Message Date
Ryo Yoshida
0a638676d1
Fix faulty variable extraction 2023-04-12 02:35:43 +09:00
Ryo Yoshida
e6e48728da
Add tests for stability check in completion 2023-04-11 21:21:15 +09:00
Ryo Yoshida
0ce71dd76f
completion: check stability 2023-04-11 21:21:13 +09:00
Ryo Yoshida
584d2697cc
Add toolchain meta for tests 2023-04-11 21:21:10 +09:00
bors
5d41affc77 Auto merge of #14547 - Veykril:extract_adjust, r=Veykril
fix: Fix receiver adjustments for extract_variable assist
2023-04-11 12:01:47 +00:00
Lukas Wirth
72d47144e8 fix: Fix receiver adjustments for extract_variable assist 2023-04-11 14:01:23 +02:00
bors
f9f443076a Auto merge of #14540 - AmrDeveloper:disallow_extract_fun_single_brace, r=Veykril
Fix allow extracting function from single brace of block expression

Fix allow extracting function when selecting either `{` or `}`

Fix #14514
2023-04-11 10:10:25 +00:00
AmrDeveloper
5ded22065e Make all kind of braces not applicable in function extraction 2023-04-11 11:22:52 +02:00
bors
fa3db447d7 Auto merge of #14536 - ClSlaid:feat/reorder-impl-items/not-applicative-editing-assoc-items, r=Veykril
fix: restrict applicable range of `reorder-impl-trait-items`

This PR should complete the need for restricting the applicable range of `reorder-impl-trait-items`.

When the cursor is in the associated items of the `impl` range, the assist will be disabled.

Fix: #14515

## Showcases
Note: If there is any available `code-action` (`ide-assist`) available, a lightbulb icon from `lspsaga` will show in the left.

- cursor in `impl` headers
![code action available](https://user-images.githubusercontent.com/44747719/230756854-7b236018-cfa8-4005-b589-2996ec42917f.png)
Code action is available. And it is reordering impl items.
![code action detail](https://user-images.githubusercontent.com/44747719/230756971-341c7fbc-f2ba-4715-a1e5-b1add984d4dd.png)

- cursor in `impl` associated items
![code action unavailable](
https://user-images.githubusercontent.com/44747719/230756906-bee7784e-bd9d-49b2-801b-743c94b4af54.png)
2023-04-11 07:36:42 +00:00
bors
208a74ca50 Auto merge of #14535 - davidbarsky:davidbarsky/use-parent-folder-for-discovery-cwd, r=Veykril
fix: when running the "discoverProjectCommand", use the Rust file's parent directory instead of the workspace folder

This is a quick fix to allow the `discoverProjectCommand` to run successfully when the user has a workspace that does not, e.g., have a `.buckconfig` defined.

(It's also probably _more correct_ to set the `pwd` of the command to the parent of the Rust file _anyways_ rather than relying on the workspace folders, which may be entirely unrelated.)
2023-04-11 07:22:40 +00:00
bors
44cf8ef49a Auto merge of #14470 - HKalbasi:mir, r=HKalbasi
Compute closure captures

This PR:
* Computes closure captures and the trait it implements (Fn, FnMut or FnOnce)
* Computes data layout of closures
* Adds support for closure MIR lowering
* Changes the closure type display from `|arg1: ty1, arg2: ty| -> ret` to `impl FnX(arg1: ty1, arg2: ty2) -> ret`

fix #12297
2023-04-10 19:43:51 +00:00
hkalbasi
59b6f2d9f2 Compute closure captures 2023-04-10 23:04:34 +03:30
David Barsky
b99c129b74 fix: when running the "discoverProjectCommand", use the Rust file's
parent directory instead of the workspace folder.
2023-04-10 09:36:38 -04:00
AmrDeveloper
2afc124cb9 Fix allow extracting function from single brace of block expression 2023-04-09 23:44:31 +02:00
bors
51d5862caf Auto merge of #14538 - Veykril:project-link-fix, r=Veykril
fix: Fix project linking popup appearing for modules that can be linked to a crate

should fix https://github.com/rust-lang/rust-analyzer/issues/14523
2023-04-09 08:18:12 +00:00
Lukas Wirth
98a673c4a8 fix: Fix project linking popup appearing for modules that can be linked to a crate 2023-04-09 10:17:58 +02:00
蔡略
475aa2839f refactor: correct test sample
giving a sorted file is useless

Signed-off-by: 蔡略 <cailue@bupt.edu.cn>
2023-04-09 00:24:25 +08:00
蔡略
e90e1901ef feat: restrict applicable range of reorder-impl-trait-items 2023-04-09 00:14:48 +08:00
bors
01120f1213 Auto merge of #14528 - HKalbasi:revert-14526-revert-14521-dev, r=Veykril
Add bounds for fields in derive macro, second try
2023-04-07 16:19:13 +00:00
hkalbasi
c54cb88950 Add bounds for associated types in derive macro 2023-04-07 19:33:14 +03:30
bors
972f1313eb Auto merge of #14526 - rust-lang:revert-14521-dev, r=Veykril
Revert "Add bounds for fields in derive macro"

Reverts rust-lang/rust-analyzer#14521 as it introduces too many mismatches
2023-04-07 09:02:31 +00:00
Lukas Wirth
435d585d0c
Revert "Add bounds for fields in derive macro" 2023-04-07 11:01:17 +02:00
bors
bca364c3fe Auto merge of #14525 - Veykril:hir-pretty, r=Veykril
internal: Remove parameter names from function item tree
2023-04-07 07:57:58 +00:00
Lukas Wirth
79c4c4fb48 Remove parameter names from function item tree 2023-04-07 09:57:19 +02:00
bors
d73161b491 Auto merge of #14524 - Veykril:hir-pretty, r=Veykril
internal: Render function parameters in hir-def pretty printing
2023-04-07 07:34:45 +00:00
Lukas Wirth
513d4a9c9a Render function parameters in hir-def pretty printing 2023-04-07 09:34:04 +02:00
bors
937ef97bc5 Auto merge of #14521 - HKalbasi:dev, r=Veykril
Add bounds for fields in derive macro

Dependency of #14470
2023-04-07 04:45:41 +00:00
hkalbasi
0241b52dad Add bounds for fields in derive macro 2023-04-07 02:21:46 +03:30
bors
e739c999cd Auto merge of #14511 - HKalbasi:dev, r=Veykril
Always reborrow mutable reference receiver in methods

Dependency of #14470
2023-04-06 21:18:15 +00:00
hkalbasi
7ba93cb8cf Always reborrow reference receiver in methods 2023-04-07 00:32:28 +03:30
bors
ca0f6bbf2f Auto merge of #14520 - lowr:fix/unify-variable-fallout, r=Veykril
fix: unify types in `infer_expr_coerce_never()`

Fixes #14506

#14506 turned out to be a regression in type inference. `infer_expr_coerce_never()` added in #14251 allows never-to-any coercion but should also perform ordinary type unification in other cases.
2023-04-06 21:02:15 +00:00
Ryo Yoshida
5ab4e64a4c
fix: unify types in infer_expr_coerce_never() 2023-04-07 05:46:30 +09:00
bors
625a6f37de Auto merge of #14519 - Veykril:hir-def-refac, r=Veykril
internal: Don't recreate Hygiene unnecessarily
2023-04-06 19:19:19 +00:00
Lukas Wirth
f742943a4b Don't recreate Hygiene unnecessarily 2023-04-06 21:16:11 +02:00
bors
a1e8535f44 Auto merge of #14518 - Veykril:hir-def-refac, r=Veykril
internal: Remove unnecessary Names from FunctionData::params
2023-04-06 18:20:32 +00:00
Lukas Wirth
b7c443569a Don't unnecessarily query the ast_id_map for blocks if they aren't interned 2023-04-06 20:19:59 +02:00
Lukas Wirth
a1b96b1e00 Remove unnecessary Names from FunctionData::params 2023-04-06 20:14:51 +02:00
bors
58da3fc240 Auto merge of #14517 - Veykril:hir-def-refac, r=Veykril
internal: Shuffle around some hir_def modules
2023-04-06 17:58:28 +00:00
Lukas Wirth
3f5c9920d6 Move hir_def::builtin_attr to hir_def::attr::builtin 2023-04-06 19:55:49 +02:00
Lukas Wirth
12b069f434 Move hir_def::keys to hir_def::dyn_map 2023-04-06 19:49:33 +02:00
Lukas Wirth
40c068f502 Use hir_def::builtin_attr::find_builtin_attr_idx 2023-04-06 19:44:29 +02:00
Lukas Wirth
99b69525f4 hir_def::expr -> hir_def::hir, hir_def::type_ref -> hir_def::hir::type_ref 2023-04-06 19:36:25 +02:00
Lukas Wirth
8e7c104b3a Move hir_def::adt to hir_def::data::adt 2023-04-06 19:23:29 +02:00
bors
3dd17bcfc3 Auto merge of #14512 - bvanjoi:fix-14489, r=Veykril
fix(ide): highlight escapes in char

close #14489

before:

![image](https://user-images.githubusercontent.com/30187863/230414343-16f34d31-e2a1-460b-b09f-f288b196c54e.png)

after:

![image](https://user-images.githubusercontent.com/30187863/230414581-b8c37355-6626-4745-9f2b-3d9d4f804b47.png)
2023-04-06 16:03:30 +00:00
bvanjoi
f0c74b30ed fix(ide): highlight escapes in char 2023-04-06 23:20:12 +08:00
bors
4ccc83a759 Auto merge of #14509 - Veykril:label-lower-body, r=Veykril
internal: Resolve labels in body lowering

Fixes https://github.com/rust-lang/rust-analyzer/issues/14503#issuecomment-1498951837
2023-04-06 13:58:39 +00:00
Lukas Wirth
fbb1bd5880 Re-enable controlflow outside loop diagnostic 2023-04-06 15:37:53 +02:00
Lukas Wirth
0e7117900c internal: Resolve labels in body lowering 2023-04-06 14:21:20 +02:00
bors
e9e57725aa Auto merge of #14505 - Veykril:block-trait-impls, r=Veykril
fix: Fix block local impl trait solving regressions

Fixes https://github.com/rust-lang/rust-analyzer/issues/14443
2023-04-06 08:37:33 +00:00
Lukas Wirth
1c16e4ee97 fix: Fix block local impl trait solving regressions 2023-04-06 10:37:00 +02:00