Closed
Description
Point to the return type with an appropriate label on
fn foo() -> impl std::fmt::Display {
if false {
return 0i32;
}
1u64
}
An appropriate wording should be figured out, but it can be along the lines of
error[E0308]: mismatched types
--> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:5:5
|
LL | fn foo() -> impl std::fmt::Display {
| ---------------------- expected because this `impl Trait` return type...
LL | if false {
LL | return 0i32;
| ---- ...gets coerced to `i32` here
LL | }
LL | 1u32
| ^^^^ expected i32, found u64
|
= note: expected type `i32`
found type `u64`
CC @nikomatsakis @zackmdavis @oli-obk @varkor who might have thoughts on wording.