Skip to content

'times' Iterating incorrect number of times #3398

Closed
@doublec

Description

@doublec

The following code using 'times' only prints 44 lines, whereas I'd expect it to print 300 lines.

use std;

fn main() {
        for 300.times {
            io::println("Here's some Rust!");
        }
}

Replacing '300' with 300u prints 300 lines:

use std;

fn main() {
        for 300u.times {
            io::println("Here's some Rust!");
        }
}

Tested with rust incoming branch:

$ rustc test.rs
$ ./test |wc -l
44

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