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
fails to compile. The error message correctly points to the problem but the help message's suggestion is a syntax error:
error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}`
--> src/main.rs:3:26
|
3 | println!("{}", i.pow(2));
| ^^^
help: you must specify a type for this binding, like `i32`
|
2 | for i: i32 in 0..100 {
| ^^^^^^
Following the suggestion leads to another compile error (missing 'in' in for loop). Usually the correct solution in this case is to add the type to the range (0i32..100).
The text was updated successfully, but these errors were encountered:
HugoArts
changed the title
misleading help message for ambiguous numeric type in for loop over range
misleading help message for ambiguous numeric type in for loop over a range
Jun 19, 2018
The following code (playground):
fails to compile. The error message correctly points to the problem but the help message's suggestion is a syntax error:
Following the suggestion leads to another compile error (missing 'in' in for loop). Usually the correct solution in this case is to add the type to the range (
0i32..100
).The text was updated successfully, but these errors were encountered: