Closed
Description
Given the following code: link
fn main() {
for i in 1..11.rev() {
println!("{i}");
}
}
The current output is:
Compiling playground v0.0.1 (/playground)
error[[E0689]](https://doc.rust-lang.org/nightly/error-index.html#E0689): can't call method `rev` on ambiguous numeric type `{integer}`
--> src/main.rs:2:20
|
2 | for i in 1..11.rev() {
| ^^^
|
help: you must specify a concrete type for this numeric value, like `i32`
|
2 | for i in 1..11_i32.rev() {
| ~~~~~~
For more information about this error, try `rustc --explain E0689`.
error: could not compile `playground` due to previous error
Ideally the output should something like this:
Compiling playground v0.0.1 (/playground)
error[[E0689]](https://doc.rust-lang.org/nightly/error-index.html#E0689): can't call method `rev` on ambiguous numeric type `{integer}`
--> src/main.rs:2:20
|
2 | for i in 1..11.rev() {
| ^^^
|
help: you must surround the range in parentheses to call the `rev` function
|
2 | for i in (1..11).rev() {
| + +
For more information about this error, try `rustc --explain E0689`.
error: could not compile `playground` due to previous error
@rustbot label +D-confusing +D-invalid-suggestion