Skip to content

Commit 82bcb48

Browse files
committed
---
yaml --- r: 196031 b: refs/heads/beta c: 7c62640 h: refs/heads/master i: 196029: e2b8398 196027: f251dab 196023: 0d5e094 196015: b443efa 195999: 88877fb 195967: b945c1f v: v3
1 parent 867d315 commit 82bcb48

File tree

5 files changed

+100
-141
lines changed

5 files changed

+100
-141
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: 4b0edb96d080fadccc542dad50e6576c8e11bd85
32+
refs/heads/beta: 7c62640458f1b8ac0f4d3871a265ea9555b3c3c8
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 9de34a84bb300bab1bf0227f577331620cd60511

branches/beta/src/librustc/middle/infer/combine.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use super::equate::Equate;
3737
use super::glb::Glb;
3838
use super::lub::Lub;
3939
use super::sub::Sub;
40-
use super::unify::InferCtxtMethodsForSimplyUnifiableTypes;
4140
use super::{InferCtxt, CombineResult};
4241
use super::{MiscVariable, TypeTrace};
4342
use super::type_variable::{RelationDir, BiTo, EqTo, SubtypeOf, SupertypeOf};
@@ -468,30 +467,29 @@ pub fn super_tys<'tcx, C>(this: &C,
468467

469468
// Relate integral variables to other types
470469
(&ty::ty_infer(IntVar(a_id)), &ty::ty_infer(IntVar(b_id))) => {
471-
try!(this.infcx().simple_vars(this.a_is_expected(),
472-
a_id, b_id));
470+
try!(this.infcx().int_unification_table
471+
.borrow_mut()
472+
.unify_var_var(this.a_is_expected(), a_id, b_id));
473473
Ok(a)
474474
}
475475
(&ty::ty_infer(IntVar(v_id)), &ty::ty_int(v)) => {
476-
unify_integral_variable(this, this.a_is_expected(),
477-
v_id, IntType(v))
476+
unify_integral_variable(this, this.a_is_expected(), v_id, IntType(v))
478477
}
479478
(&ty::ty_int(v), &ty::ty_infer(IntVar(v_id))) => {
480-
unify_integral_variable(this, !this.a_is_expected(),
481-
v_id, IntType(v))
479+
unify_integral_variable(this, !this.a_is_expected(), v_id, IntType(v))
482480
}
483481
(&ty::ty_infer(IntVar(v_id)), &ty::ty_uint(v)) => {
484-
unify_integral_variable(this, this.a_is_expected(),
485-
v_id, UintType(v))
482+
unify_integral_variable(this, this.a_is_expected(), v_id, UintType(v))
486483
}
487484
(&ty::ty_uint(v), &ty::ty_infer(IntVar(v_id))) => {
488-
unify_integral_variable(this, !this.a_is_expected(),
489-
v_id, UintType(v))
485+
unify_integral_variable(this, !this.a_is_expected(), v_id, UintType(v))
490486
}
491487

492488
// Relate floating-point variables to other types
493489
(&ty::ty_infer(FloatVar(a_id)), &ty::ty_infer(FloatVar(b_id))) => {
494-
try!(this.infcx().simple_vars(this.a_is_expected(), a_id, b_id));
490+
try!(this.infcx().float_unification_table
491+
.borrow_mut()
492+
.unify_var_var(this.a_is_expected(), a_id, b_id));
495493
Ok(a)
496494
}
497495
(&ty::ty_infer(FloatVar(v_id)), &ty::ty_float(v)) => {
@@ -617,8 +615,11 @@ pub fn super_tys<'tcx, C>(this: &C,
617615
vid: ty::IntVid,
618616
val: ty::IntVarValue)
619617
-> CombineResult<'tcx, Ty<'tcx>>
620-
where C: Combine<'tcx> {
621-
try!(this.infcx().simple_var_t(vid_is_expected, vid, val));
618+
where C: Combine<'tcx>
619+
{
620+
try!(this.infcx().int_unification_table
621+
.borrow_mut()
622+
.unify_var_value(vid_is_expected, vid, val));
622623
match val {
623624
IntType(v) => Ok(ty::mk_mach_int(this.tcx(), v)),
624625
UintType(v) => Ok(ty::mk_mach_uint(this.tcx(), v)),
@@ -630,8 +631,11 @@ pub fn super_tys<'tcx, C>(this: &C,
630631
vid: ty::FloatVid,
631632
val: ast::FloatTy)
632633
-> CombineResult<'tcx, Ty<'tcx>>
633-
where C: Combine<'tcx> {
634-
try!(this.infcx().simple_var_t(vid_is_expected, vid, val));
634+
where C: Combine<'tcx>
635+
{
636+
try!(this.infcx().float_unification_table
637+
.borrow_mut()
638+
.unify_var_value(vid_is_expected, vid, val));
635639
Ok(ty::mk_mach_float(this.tcx(), val))
636640
}
637641
}

branches/beta/src/librustc/middle/infer/freshen.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use middle::ty_fold::TypeFolder;
3737
use std::collections::hash_map::{self, Entry};
3838

3939
use super::InferCtxt;
40-
use super::unify::InferCtxtMethodsForSimplyUnifiableTypes;
4140

4241
pub struct TypeFreshener<'a, 'tcx:'a> {
4342
infcx: &'a InferCtxt<'a, 'tcx>,
@@ -104,29 +103,34 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
104103
}
105104

106105
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
106+
let tcx = self.infcx.tcx;
107+
107108
match t.sty {
108109
ty::ty_infer(ty::TyVar(v)) => {
109-
self.freshen(self.infcx.type_variables.borrow().probe(v),
110-
ty::TyVar(v),
111-
ty::FreshTy)
110+
self.freshen(
111+
self.infcx.type_variables.borrow().probe(v),
112+
ty::TyVar(v),
113+
ty::FreshTy)
112114
}
113115

114116
ty::ty_infer(ty::IntVar(v)) => {
115-
self.freshen(self.infcx.probe_var(v),
116-
ty::IntVar(v),
117-
ty::FreshIntTy)
117+
self.freshen(
118+
self.infcx.int_unification_table.borrow_mut().probe(tcx, v),
119+
ty::IntVar(v),
120+
ty::FreshIntTy)
118121
}
119122

120123
ty::ty_infer(ty::FloatVar(v)) => {
121-
self.freshen(self.infcx.probe_var(v),
122-
ty::FloatVar(v),
123-
ty::FreshIntTy)
124+
self.freshen(
125+
self.infcx.float_unification_table.borrow_mut().probe(tcx, v),
126+
ty::FloatVar(v),
127+
ty::FreshIntTy)
124128
}
125129

126130
ty::ty_infer(ty::FreshTy(c)) |
127131
ty::ty_infer(ty::FreshIntTy(c)) => {
128132
if c >= self.freshen_count {
129-
self.tcx().sess.bug(
133+
tcx.sess.bug(
130134
&format!("Encountered a freshend type with id {} \
131135
but our counter is only at {}",
132136
c,

branches/beta/src/librustc/middle/infer/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use self::region_inference::{RegionVarBindings, RegionSnapshot};
4343
use self::equate::Equate;
4444
use self::sub::Sub;
4545
use self::lub::Lub;
46-
use self::unify::{UnificationTable, InferCtxtMethodsForSimplyUnifiableTypes};
46+
use self::unify::UnificationTable;
4747
use self::error_reporting::ErrorReporting;
4848

4949
pub mod bivariate;
@@ -456,14 +456,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
456456
use middle::ty::UnconstrainedNumeric::{Neither, UnconstrainedInt, UnconstrainedFloat};
457457
match ty.sty {
458458
ty::ty_infer(ty::IntVar(vid)) => {
459-
match self.int_unification_table.borrow_mut().get(self.tcx, vid).value {
459+
match self.int_unification_table.borrow_mut().get(vid).value {
460460
None => UnconstrainedInt,
461461
_ => Neither,
462462
}
463463
},
464464
ty::ty_infer(ty::FloatVar(vid)) => {
465-
match self.float_unification_table.borrow_mut().get(self.tcx, vid).value {
466-
None => return UnconstrainedFloat,
465+
match self.float_unification_table.borrow_mut().get(vid).value {
466+
None => UnconstrainedFloat,
467467
_ => Neither,
468468
}
469469
},
@@ -881,12 +881,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
881881
}
882882

883883
ty::ty_infer(ty::IntVar(v)) => {
884-
self.probe_var(v)
884+
self.int_unification_table
885+
.borrow_mut()
886+
.probe(self.tcx, v)
885887
.unwrap_or(typ)
886888
}
887889

888890
ty::ty_infer(ty::FloatVar(v)) => {
889-
self.probe_var(v)
891+
self.float_unification_table
892+
.borrow_mut()
893+
.probe(self.tcx, v)
890894
.unwrap_or(typ)
891895
}
892896

0 commit comments

Comments
 (0)