"Fallback" to i32/f32 in error messages involving numeric inference #26328
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Currently error messages where the type of a variable is a integer variable or a float variable just put
_
in for the type like a regular inference variable. For straight type mismatch errors, the elaborated version prints out something likean integral variable
, which is fine, but other error messages don't. Liketrait core::ops::Div<_> is not implemented for f64
.Given that we have fallbacks to
i32
andf32
for integer and float literals respectively, it might be worth error messages acting as if that fallback has happened.trait core::ops::Div<i32> is not implemented for f64
is much more helpful, since it's fairly clear that the issue is that you're dividing a float by an integer.The text was updated successfully, but these errors were encountered: