Rust's type checking of ints and uints seems unnecessarily strict. The
following examples produce compilation errors, but their intent seems
perfectly safe within the range of the types:
let a:u8 = 1; // error even though 1i fits in u8
let b:u16 = a; // error even though u8 fits in u16
let c:i32 = b; // error even though u16 fits in i32
let d:int = c; // error even though i32 fits in int (assuming int
is 32 or 64 bits)
let e:i64 = d; // no error because int is i64 (on my machine)
Integer assignment may be a simple special case (compared to C's integer
promotion rules), but it would be convenient and simplify some code.
chris
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev