-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Error msg is obtuse when doing float_fallback += 1;
(or any int literal)
#23994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Just as a note, I think both types are _ because rustc doesn't know exactly what types they actually are. The |
x += 1;
Wishes for new features should go on the RFC repo, and the issue is already present: rust-lang/rfcs#260 |
Note: The well-defined default type for |
Nonetheless, the error message here is particularly bad ... |
(but I agree with @bluss's assessment, and conclude that my title change is not quite right.) |
x += 1;
float_fallback += 1;
(or any int literal)
float_fallback += 1;
(or any int literal)float_fallback += 1;
(or any int literal)
@bluss It didn't occur to me this would be a feature. I thought it might have just been a bug or old design decision. What a better error message would look like isn't clear which is why I didn't suggest it though. |
Instead of '_' it would be nice to have "integral type" (that language shows up elsewhere) and "float type" |
1.14 output:
This bug is fixed. |
Thank you. New bugs can be filed if there are problems with the new error message. |
This may be WONTFIX but I'm reporting it in case it isn't. I'm not sure what the opinion on this is exactly anyway. The idea came from here. This error may come up very easily on rust-lang.org and so is likely very noticeable. This:
Gives this error:
There are three issues, particularly to a new user (first time exploring
rust-lang.org
):0
and0.0
may seem bizarre_
will be puzzling and makes the error confusing_
and_
makes it worse.It would be ideal if
1
could be inferred to the type ofx
in this case. This would also avoid this confusing error on the rust main landing page.The text was updated successfully, but these errors were encountered: