diff --git a/src/rustc/middle/infer.rs b/src/rustc/middle/infer.rs index efe01f2cbd8..f0e2bcf40fe 100644 --- a/src/rustc/middle/infer.rs +++ b/src/rustc/middle/infer.rs @@ -707,7 +707,7 @@ fn rerr(v: int) -> fres { fn resolve_var( vb: vals_and_bindings, bot_guard: fn(T)->bool, - vid: int) -> fres { + vid: int, unbound: fn() -> fres) -> fres { let {root:_, bounds} = self.get(vb, vid as uint); @@ -724,16 +724,24 @@ fn resolve_var( { ub:_, lb:some(t) } if !bot_guard(t) { ok(t) } { ub:some(t), lb:_ } { ok(t) } { ub:_, lb:some(t) } { ok(t) } - { ub:none, lb:none } { self.rerr(vid) } + { ub:none, lb:none } { unbound() } } } fn resolve_ty_var(vid: int) -> fres { - ret self.resolve_var(self.vb, {|t| type_is_bot(t)}, vid); + ret self.resolve_var( + self.vb, + {|t| type_is_bot(t) }, + vid, + {|| ok(ty::mk_bot(self.tcx)) }); } fn resolve_region_var(rid: int) -> fres { - ret self.resolve_var(self.rb, {|_t| false}, rid); + ret self.resolve_var( + self.rb, + {|_t| false }, + rid, + {|| err(rid) }); } fn resolve_ty(typ: ty::t) -> fres { diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/compile-fail/vector-no-ann.rs deleted file mode 100644 index 80463e3ead3..00000000000 --- a/src/test/compile-fail/vector-no-ann.rs +++ /dev/null @@ -1,2 +0,0 @@ -// error-pattern:cannot determine a type -fn main() { let foo = []; } diff --git a/src/test/run-pass/vector-no-ann.rs b/src/test/run-pass/vector-no-ann.rs new file mode 100644 index 00000000000..dec8ca27db6 --- /dev/null +++ b/src/test/run-pass/vector-no-ann.rs @@ -0,0 +1,4 @@ +fn main() { + // We will infer this to have the type vec[bot] + let _foo = []; +} diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 0640bacbfe4..e13c1a0d6af 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -1,6 +1,6 @@ // Just a grab bag of stuff that you wouldn't want to actually write. -fn strange() -> bool { let _x: bool = ret true; } +fn strange() -> bool { let _x = ret true; } fn funny() { fn f(_x: ()) { } @@ -19,8 +19,8 @@ fn zombiejesus() { do { while (ret) { if (ret) { - alt check (ret) { - 1 { + alt (ret) { + _ { if (ret) { ret } else { @@ -51,7 +51,7 @@ fn canttouchthis() -> uint { pure fn p() -> bool { true } let _a = (assert (true)) == (check (p())); let _c = (check (p())) == (); - let _b: bool = (log(debug, 0) == (ret 0u)); + let _b = (log(debug, 0) == (ret 0u)); } fn angrydome() {