Skip to content

uint accepts negative numbers #184

Closed
@nth10sd

Description

@nth10sd
fn main() {
    let uint x = -1 as uint;
    log x;
}

This testcase seems to show that negative numbers can be accepted as unsigned integers. Unsigned integers should only comprise of non-negative numbers.

(not sure if this is working as intended.)

On repository revision 5955e23 on Mac 10.6.5.

Output:
$ ./rustboot -L . -o 2out.out 2test.rs

$ ./2out.out

rt: ---
rt: a5ed:main:main: rust: -1 (0xffffffff)

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