diff --git a/src/rustc/middle/infer.rs b/src/rustc/middle/infer.rs index 4f2cbf7abb61..99e404e09e1e 100644 --- a/src/rustc/middle/infer.rs +++ b/src/rustc/middle/infer.rs @@ -961,7 +961,8 @@ iface combine { fn tag() -> str; fn bnd(b: bounds) -> option; fn with_bnd(b: bounds, v: V) -> bounds; - fn c_bot(b: ty::t) -> cres; + fn c_bot_ty(b: ty::t) -> cres; + fn c_ty_bot(b: ty::t) -> cres; fn c_mts(a: ty::mt, b: ty::mt) -> cres; fn c_contratys(t1: ty::t, t2: ty::t) -> cres; fn c_tys(t1: ty::t, t2: ty::t) -> cres; @@ -974,7 +975,8 @@ iface combine { a: ty::region, b: ty::region) -> cres; fn c_regions( a: ty::region, b: ty::region) -> cres; - fn c_regions_static(r: ty::region) -> cres; + fn c_regions_static_r(r: ty::region) -> cres; + fn c_regions_r_static(r: ty::region) -> cres; fn c_regions_scope_scope( a: ty::region, a_id: ast::node_id, b: ty::region, b_id: ast::node_id) -> cres; @@ -1171,8 +1173,8 @@ fn c_tys( indent {|| alt (ty::get(a).struct, ty::get(b).struct) { - (ty::ty_bot, _) { self.c_bot(b) } - (_, ty::ty_bot) { self.c_bot(b) } + (ty::ty_bot, _) { self.c_ty_bot(b) } + (_, ty::ty_bot) { self.c_bot_ty(b) } (ty::ty_var(a_id), ty::ty_var(b_id)) { c_vars(self, self.infcx().vb, @@ -1314,8 +1316,12 @@ fn c_regions( indent {|| alt (a, b) { - (ty::re_static, r) | (r, ty::re_static) { - self.c_regions_static(r) + (ty::re_static, r) { + self.c_regions_static_r(r) + } + + (r, ty::re_static) { + self.c_regions_r_static(r) } (ty::re_var(a_id), ty::re_var(b_id)) { @@ -1386,10 +1392,14 @@ impl of combine for lub { {ub: some(v) with b} } - fn c_bot(b: ty::t) -> cres { + fn c_bot_ty(b: ty::t) -> cres { ok(b) } + fn c_ty_bot(b: ty::t) -> cres { + self.c_bot_ty(b) // LUB is commutative + } + fn c_mts(a: ty::mt, b: ty::mt) -> cres { let tcx = self.infcx().tcx; @@ -1465,12 +1475,15 @@ impl of combine for lub { ret glb(self.infcx()).c_regions(a, b); } - fn c_regions_static(_r: ty::region) -> cres { - // LUB of `r` and static is always static---what's bigger than - // that? + fn c_regions_static_r(_r: ty::region) -> cres { + // nothing lives longer than static ret ok(ty::re_static); } + fn c_regions_r_static(r: ty::region) -> cres { + self.c_regions_static_r(r) // LUB is commutative + } + fn c_regions_free_scope( a: ty::region, _a_id: ast::node_id, _a_br: ty::bound_region, _b: ty::region, _b_id: ast::node_id) -> cres { @@ -1517,10 +1530,14 @@ impl of combine for glb { {lb: some(v) with b} } - fn c_bot(_b: ty::t) -> cres { + fn c_bot_ty(_b: ty::t) -> cres { ok(ty::mk_bot(self.infcx().tcx)) } + fn c_ty_bot(b: ty::t) -> cres { + self.c_bot_ty(b) // GLB is commutative + } + fn c_mts(a: ty::mt, b: ty::mt) -> cres { let tcx = self.infcx().tcx; @@ -1614,12 +1631,15 @@ impl of combine for glb { ret lub(self.infcx()).c_regions(a, b); } - fn c_regions_static(r: ty::region) -> cres { - // GLB of `r` and static is always `r`; static is bigger than - // everything + fn c_regions_static_r(r: ty::region) -> cres { + // static lives longer than everything else ret ok(r); } + fn c_regions_r_static(r: ty::region) -> cres { + self.c_regions_static_r(r) // GLB is commutative + } + fn c_regions_free_scope( _a: ty::region, _a_id: ast::node_id, _a_br: ty::bound_region, b: ty::region, _b_id: ast::node_id) -> cres {