-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
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:
fn main() {
let mut x = 0.0;
x += 1;
}Gives this error:
<anon>:3:5: 3:6 error: binary assignment operation `+=` cannot be applied to types `_` and `_` [E0368]
<anon>:3 x += 1;
^
error: aborting due to previous error
playpen: application terminated with error code 101There are three issues, particularly to a new user (first time exploring rust-lang.org):
- The distinction
0and0.0may seem bizarre - Use of the mysterious type
_will be puzzling and makes the error confusing - Comparing
_and_makes it worse.
It would be ideal if 1 could be inferred to the type of x in this case. This would also avoid this confusing error on the rust main landing page.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints