mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
resolve type variables with no constraints to bot
This commit is contained in:
parent
f452973a7f
commit
76d0a13ae5
@ -707,7 +707,7 @@ impl resolve_methods for infer_ctxt {
|
|||||||
|
|
||||||
fn resolve_var<T:copy to_str>(
|
fn resolve_var<T:copy to_str>(
|
||||||
vb: vals_and_bindings<T>, bot_guard: fn(T)->bool,
|
vb: vals_and_bindings<T>, bot_guard: fn(T)->bool,
|
||||||
vid: int) -> fres<T> {
|
vid: int, unbound: fn() -> fres<T>) -> fres<T> {
|
||||||
|
|
||||||
let {root:_, bounds} = self.get(vb, vid as uint);
|
let {root:_, bounds} = self.get(vb, vid as uint);
|
||||||
|
|
||||||
@ -724,16 +724,24 @@ impl resolve_methods for infer_ctxt {
|
|||||||
{ ub:_, lb:some(t) } if !bot_guard(t) { ok(t) }
|
{ ub:_, lb:some(t) } if !bot_guard(t) { ok(t) }
|
||||||
{ ub:some(t), lb:_ } { ok(t) }
|
{ ub:some(t), lb:_ } { ok(t) }
|
||||||
{ ub:_, lb:some(t) } { 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<ty::t> {
|
fn resolve_ty_var(vid: int) -> fres<ty::t> {
|
||||||
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<ty::region> {
|
fn resolve_region_var(rid: int) -> fres<ty::region> {
|
||||||
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<ty::t> {
|
fn resolve_ty(typ: ty::t) -> fres<ty::t> {
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
// error-pattern:cannot determine a type
|
|
||||||
fn main() { let foo = []; }
|
|
4
src/test/run-pass/vector-no-ann.rs
Normal file
4
src/test/run-pass/vector-no-ann.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
fn main() {
|
||||||
|
// We will infer this to have the type vec[bot]
|
||||||
|
let _foo = [];
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
// Just a grab bag of stuff that you wouldn't want to actually write.
|
// 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 funny() {
|
||||||
fn f(_x: ()) { }
|
fn f(_x: ()) { }
|
||||||
@ -19,8 +19,8 @@ fn zombiejesus() {
|
|||||||
do {
|
do {
|
||||||
while (ret) {
|
while (ret) {
|
||||||
if (ret) {
|
if (ret) {
|
||||||
alt check (ret) {
|
alt (ret) {
|
||||||
1 {
|
_ {
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ret
|
ret
|
||||||
} else {
|
} else {
|
||||||
@ -51,7 +51,7 @@ fn canttouchthis() -> uint {
|
|||||||
pure fn p() -> bool { true }
|
pure fn p() -> bool { true }
|
||||||
let _a = (assert (true)) == (check (p()));
|
let _a = (assert (true)) == (check (p()));
|
||||||
let _c = (check (p())) == ();
|
let _c = (check (p())) == ();
|
||||||
let _b: bool = (log(debug, 0) == (ret 0u));
|
let _b = (log(debug, 0) == (ret 0u));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn angrydome() {
|
fn angrydome() {
|
||||||
|
Loading…
Reference in New Issue
Block a user