I played with some code and made the following observation:
let x = 1;
let () = x;
error: mismatched types [E0308]
note: expected type `_`
note: found type `()`
This obviously fails, but I expected the error to indicate that the expected type was i32, and not _. I found that the same thing happens with a floating literal of indefinite type, for example. 1.0.
Why is that? Should the type already be known as the default?
Update : from the point of view of Rust 1.12, the error message is more informative:
expected integral variable, found ()
= note: expected type `{integer}`
= note: found type `()`
source
share