]> git.lizzy.rs Git - rust.git/commit
Auto merge of #12680 - lowr:fix/12428-regression, r=Veykril
authorbors <bors@rust-lang.org>
Sat, 2 Jul 2022 19:00:49 +0000 (19:00 +0000)
committerbors <bors@rust-lang.org>
Sat, 2 Jul 2022 19:00:49 +0000 (19:00 +0000)
commitd1ac46201d568fbe08deabafaa91100a1810d31b
tree1eb5b63d4e9fb33dcc349f848cfe40e2813983fa
parentd101439c77c6842e41e04f1438eb1d93095dea52
parent649e1f54cfb9b2b0a17261e5fb20d7745ffec4d3
Auto merge of #12680 - lowr:fix/12428-regression, r=Veykril

fix regressions on assignment expressions

This is a follow-up PR on #12428. I'm not sure if this is everything I overlooked, so if there are more things that are not right, we may want to revert #12428.

This should also fix the increase of the type mismatches and the unknown types in diesel in the [metrics](https://rust-analyzer.github.io/metrics/?start=2022-06-23&end=2022-07-01) introduced by #12428.

The regressions are:

- some coercions don't work in the ordinary (i.e. non-destructuring) assignments

    In order for coercions on ADT fields instantiations to work, lhs type has to be known before inferring rhs. #12428 changed the inference order, making rhs inferred before lhs, breaking the coercion, so I restored the original inference mechanism for the ordinary assignments.

    Note that this kind of coercion doesn't happen in destructuring assigments, because when they are desugared, the struct expression is first assigned to a temporary, which is then assigned to the assignee, which is not coercion site anymore.

- type mismatches on individual identifiers are not reported