rust/crates
bors 2ff505ab48 Auto merge of #12428 - lowr:experimental/destructuring-assignment, r=flodiebold
feat: implement destructuring assignment

This is an attempt to implement destructuring assignments, or more specifically, type inference for [assignee expressions](https://doc.rust-lang.org/reference/expressions.html#place-expressions-and-value-expressions).

I'm not sure if this is the right approach, so I don't even expect this to be merged (hence the branch name 😉) but rather want to propose one direction we could choose. I don't mind getting merged if this is good enough though!

Some notes on the implementation choices:

- Assignee expressions are **not** desugared on HIR level unlike rustc, but are inferred directly along with other expressions. This matches the processing of other syntaxes that are desugared in rustc but not in r-a. I find this reasonable because r-a only needs to infer types and it's easier to relate AST nodes and HIR nodes, so I followed it.
- Assignee expressions obviously resemble patterns, so type inference for each kind of pattern and its corresponding assignee expressions share a significant amount of logic. I tried to reuse the type inference functions for patterns by introducing `PatLike` trait which generalizes assignee expressions and patterns.
  - This is not the most elegant solution I suspect (and I really don't like the name of the trait!), but it's cleaner and the change is smaller than other ways I experimented, like making the functions generic without such trait, or making them take `Either<ExprId, PatId>` in place of `PatId`.

in case this is merged:
Closes #11532
Closes #11839
Closes #12322
2022-06-30 09:14:12 +00:00
..
base-db Show proc-macro loading errors in unresolved-proc-macro diagnostics 2022-06-15 17:34:01 +02:00
cfg internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
flycheck Send a DidCancel event when restarting flychecks 2022-06-16 15:25:50 +02:00
hir fix: Report proc macro errors in expressions correctly as well 2022-06-28 10:43:22 +02:00
hir-def Auto merge of #12428 - lowr:experimental/destructuring-assignment, r=flodiebold 2022-06-30 09:14:12 +00:00
hir-expand fix: Report proc macro errors in expressions correctly as well 2022-06-28 10:43:22 +02:00
hir-ty Auto merge of #12428 - lowr:experimental/destructuring-assignment, r=flodiebold 2022-06-30 09:14:12 +00:00
ide clarify comment and add autolink test case 2022-06-23 19:02:30 -04:00
ide-assists restrict the assist so that it only appears if the cursor is on the loop keyword 2022-06-11 07:11:56 +08:00
ide-completion Auto merge of #12643 - Veykril:macro-compl, r=Veykril 2022-06-27 12:40:46 +00:00
ide-db fix: inserted imports must come after a shebang if present 2022-06-15 19:42:43 +00:00
ide-diagnostics fix: Report proc macro errors in expressions correctly as well 2022-06-28 10:43:22 +02:00
ide-ssr internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
limit Use compare_exchange_weak in limit::Limit::check 2022-01-28 18:19:35 +03:00
mbe internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
parser internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
paths Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
proc-macro-api Show proc-macro loading errors in unresolved-proc-macro diagnostics 2022-06-15 17:34:01 +02:00
proc-macro-srv Auto merge of #12502 - Veykril:deps, r=Veykril 2022-06-10 19:51:04 +00:00
proc-macro-test delete a generated swap file 2022-05-01 10:48:58 +00:00
profile internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
project-model fix: Report proc macro errors in expressions correctly as well 2022-06-28 10:43:22 +02:00
rust-analyzer fix: Report proc macro errors in expressions correctly as well 2022-06-28 10:43:22 +02:00
sourcegen internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
stdx Polish 2022-06-15 18:35:48 +02:00
syntax internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
test-utils internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
text-edit style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
toolchain Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
tt internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
vfs internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
vfs-notify internal: Bump Dependencies 2022-06-10 17:30:02 +02:00