mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
3f1ddd5788
Always make tuple elements a coercion site
Previously we only used `check_expr_coercible_to_type` if we had an expectation (using `check_expr_with_expectation(NoExpectation)` otherwise). Normally that'd be fine, because without an expectation we can't insert a coercion anyway. However, for the case of never-to-any coercion specifically, we _do_ insert it eagerly, so this prevents some code from compiling, for example:
```rust
((),) = (loop {},);
```
With this PR we are always using `check_expr_coercible_to_type` (using an infer var if there is no expectation), which allows slightly more code to compile.
Fixes rust-lang/rust#112856
r? BoxyUwU
For more information about how rustc works, see the rustc dev guide.