rustc: make integral type inference transactional, close #3211, close #4401, close #3398.

This commit is contained in:
Graydon Hoare 2013-01-30 16:21:10 -08:00
parent 592c2e1db4
commit 4030aaff20
13 changed files with 64 additions and 91 deletions

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let v = [ (1, 2), (3, 4), (5, 6) ];
let v : &[(int,int)] = &[ (1, 2), (3, 4), (5, 6) ];
for v.each |&(x, y)| {
io::println(y.to_str());
io::println(x.to_str());

View file

@ -1,7 +1,7 @@
struct S<T>(T);
fn main() {
let s = S(2);
let s = S(2i);
io::println(s.to_str());
}

View file

@ -0,0 +1,8 @@
fn main() {
let mut x = 0;
for 4096.times {
x += 1;
}
assert x == 4096;
io::println(fmt!("x = %u", x));
}

View file

@ -0,0 +1,8 @@
fn main() {
let mut count = 0;
for 999_999.times() {
count += 1;
}
assert count == 999_999;
io::println(fmt!("%u", count));
}

View file

@ -15,17 +15,11 @@
fn main() {
// ints
// num
assert 15.add(&6) == 21;
assert 15i.add(&6) == 21;
assert 15i8.add(&6i8) == 21i8;
assert 15i16.add(&6i16) == 21i16;
assert 15i32.add(&6i32) == 21i32;
assert 15i64.add(&6i64) == 21i64;
// times
15.times(|| false);
15i8.times(|| false);
15i16.times(|| false);
15i32.times(|| false);
15i64.times(|| false);
// uints
// num
@ -34,12 +28,9 @@ fn main() {
assert 15u16.add(&6u16) == 21u16;
assert 15u32.add(&6u32) == 21u32;
assert 15u64.add(&6u64) == 21u64;
// times
15u.times(|| false);
15u8.times(|| false);
15u16.times(|| false);
15u32.times(|| false);
15u64.times(|| false);
// floats
// num