You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I mistyped a ; as a : because it was following a ) which requires holding the shift key on American keyboards. It would be nice if the error message mentioned why it was expecting a type.
Sample code:
fn main() {
println!("test"):
0;
}
Current error:
rustc 1.17.0 (56124baa9 2017-04-24)
error: expected type, found `0`
--> <anon>:3:5
|
3 | 0;
| ^
error: aborting due to previous error
It would be nice if it said something like this:
rustc 1.17.0 (56124baa9 2017-04-24)
error: expected type, found `0`
--> <anon>:3:5
|
3 | 0;
| ^
error: aborting due to previous error
--> <anon>:2:21
|
2 | println!("test"):
| ^
hint: expecting a type because of type ascription here
The text was updated successfully, but these errors were encountered:
Point at `:` when using it instead of `;`
When triggering type ascription in such a way that we can infer a
statement end was intended, add a suggestion for the change. Always
point out the reason for the expectation of a type is due to type
ascription.
Fix#42057, #41928.
I mistyped a
;
as a:
because it was following a)
which requires holding the shift key on American keyboards. It would be nice if the error message mentioned why it was expecting a type.Sample code:
Current error:
It would be nice if it said something like this:
The text was updated successfully, but these errors were encountered: