error[E0308]: `if` and `else` have incompatible types
--> src/main.rs:13:9
|
10 | / if true {
11 | | S
| | - expected because of this
12 | | } else {
13 | | Y
| | ^ expected struct `S`, found struct `Y`
14 | | }
| |_____- `if` and `else` have incompatible types
Given the following
we currently emit
We should suggest changing the return type from
impl TraittoBox<dyn Trait>and boxing the two branches. I think this is the last missing suggestion we can give involdingimpl Traitanddyn Traitreturns.Follow up to #68110.