Skip to content

Need proper tip for range syntax #21502

Closed
@bombless

Description

@bombless

For

fn foo() {
    for i in 0 .. 9us {
        println!("{}", i)
    }
}

it compiles fine, and for

fn bar(len: usize) {
    for i in 0 .. len {
        println!("{}", i)
    }
}

compiler shows

3:10: 3:11 error: expected `:`, found `!`

It should give a tip that parentheses are missing anyway.

Rustc version:

rustc 1.0.0-dev (1028e185f 2015-01-20 18:12:41 +0800)
binary: rustc
commit-hash: 1028e185f91482551f629e97b8c3ad7ce0ade2f7
commit-date: 2015-01-20 18:12:41 +0800
host: i686-pc-windows-gnu
release: 1.0.0-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions