-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Integral type mismatch error messages should use "expression" instead of "variable" #56115
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
It's probably sufficient just to change: Lines 213 to 214 in e7b4bc3
to: ty::Infer(ty::IntVar(_)) => "integer".into(),
ty::Infer(ty::FloatVar(_)) => "floating-point number".into(), |
Do you think the |
Those should not appear in user error messages, so they can be ignored. |
Is there anyone working on this issue? If not, I would like to have a try. |
I almost finished the change, but I start to worry about whether we really want to change it.
|
Well done! I'm certain this is an improvement for users, since we also emit this message for integer literals. In my head, "integer -> oh, my integer-typed variable" flows very nicely, compared to the original report above where I have to make the inference "integral variable -> uuuhh, the literal integer I put there". Reading the updated I have seen this message used in the submodules for |
Type mismatch error messages involving integral expressions use the word "variable", when the problematic term is an expression.
I tried this code:
I expected to see this happen:
Instead, this happened:
Meta
rustc --version --verbose
:Backtrace: N/A
The text was updated successfully, but these errors were encountered: