@@ -18,8 +18,8 @@ use self::lifetime_var::LifetimeInferenceVariable;
18
18
19
19
#[ derive( Clone ) ]
20
20
pub struct InferenceTable {
21
- unify : ena:: UnificationTable < TyInferenceVariable > ,
22
- values : Vec < Arc < Ty > > ,
21
+ ty_unify : ena:: UnificationTable < TyInferenceVariable > ,
22
+ ty_values : Vec < Arc < Ty > > ,
23
23
24
24
krate_unify : ena:: UnificationTable < KrateInferenceVariable > ,
25
25
@@ -30,8 +30,10 @@ pub struct InferenceTable {
30
30
}
31
31
32
32
pub struct InferenceSnapshot {
33
- unify_snapshot : ena:: Snapshot < TyInferenceVariable > ,
34
- values_len : usize ,
33
+ ty_unify_snapshot : ena:: Snapshot < TyInferenceVariable > ,
34
+ ty_values_len : usize ,
35
+
36
+ krate_unify_snapshot : ena:: Snapshot < KrateInferenceVariable > ,
35
37
}
36
38
37
39
pub type ParameterInferenceVariable = ParameterKind < TyInferenceVariable ,
@@ -41,9 +43,9 @@ pub type ParameterInferenceVariable = ParameterKind<TyInferenceVariable,
41
43
impl InferenceTable {
42
44
pub fn new ( ) -> Self {
43
45
InferenceTable {
44
- unify : ena:: UnificationTable :: new ( ) ,
46
+ ty_unify : ena:: UnificationTable :: new ( ) ,
45
47
krate_unify : ena:: UnificationTable :: new ( ) ,
46
- values : vec ! [ ] ,
48
+ ty_values : vec ! [ ] ,
47
49
lifetime_vars : vec ! [ ] ,
48
50
}
49
51
}
@@ -57,7 +59,7 @@ impl InferenceTable {
57
59
}
58
60
59
61
pub fn new_variable ( & mut self , ui : UniverseIndex ) -> TyInferenceVariable {
60
- self . unify . new_key ( TyInferenceValue :: Unbound ( ui) )
62
+ self . ty_unify . new_key ( TyInferenceValue :: Unbound ( ui) )
61
63
}
62
64
63
65
pub fn new_lifetime_variable ( & mut self , ui : UniverseIndex ) -> LifetimeInferenceVariable {
@@ -84,20 +86,22 @@ impl InferenceTable {
84
86
}
85
87
86
88
pub fn snapshot ( & mut self ) -> InferenceSnapshot {
87
- let unify_snapshot = self . unify . snapshot ( ) ;
89
+ let ty_unify_snapshot = self . ty_unify . snapshot ( ) ;
90
+ let krate_unify_snapshot = self . krate_unify . snapshot ( ) ;
88
91
InferenceSnapshot {
89
- unify_snapshot : unify_snapshot,
90
- values_len : self . values . len ( ) ,
92
+ ty_unify_snapshot,
93
+ krate_unify_snapshot,
94
+ ty_values_len : self . ty_values . len ( ) ,
91
95
}
92
96
}
93
97
94
98
pub fn rollback_to ( & mut self , snapshot : InferenceSnapshot ) {
95
- self . unify . rollback_to ( snapshot. unify_snapshot ) ;
96
- self . values . truncate ( snapshot. values_len ) ;
99
+ self . ty_unify . rollback_to ( snapshot. ty_unify_snapshot ) ;
100
+ self . ty_values . truncate ( snapshot. ty_values_len ) ;
97
101
}
98
102
99
103
fn commit ( & mut self , snapshot : InferenceSnapshot ) {
100
- self . unify . commit ( snapshot. unify_snapshot ) ;
104
+ self . ty_unify . commit ( snapshot. ty_unify_snapshot ) ;
101
105
}
102
106
103
107
fn commit_if_ok < F , R > ( & mut self , op : F ) -> Result < R >
@@ -120,9 +124,9 @@ impl InferenceTable {
120
124
fn normalize_shallow ( & mut self , leaf : & Ty ) -> Option < Arc < Ty > > {
121
125
leaf. inference_var ( )
122
126
. and_then ( |var| {
123
- match self . unify . probe_value ( var) {
127
+ match self . ty_unify . probe_value ( var) {
124
128
TyInferenceValue :: Unbound ( _) => None ,
125
- TyInferenceValue :: Bound ( val) => Some ( self . values [ val. as_usize ( ) ] . clone ( ) ) ,
129
+ TyInferenceValue :: Bound ( val) => Some ( self . ty_values [ val. as_usize ( ) ] . clone ( ) ) ,
126
130
}
127
131
} )
128
132
}
@@ -135,9 +139,9 @@ impl InferenceTable {
135
139
}
136
140
137
141
fn probe_var ( & mut self , var : TyInferenceVariable ) -> Option < Arc < Ty > > {
138
- match self . unify . probe_value ( var) {
142
+ match self . ty_unify . probe_value ( var) {
139
143
TyInferenceValue :: Unbound ( _) => None ,
140
- TyInferenceValue :: Bound ( val) => Some ( self . values [ val. as_usize ( ) ] . clone ( ) ) ,
144
+ TyInferenceValue :: Bound ( val) => Some ( self . ty_values [ val. as_usize ( ) ] . clone ( ) ) ,
141
145
}
142
146
}
143
147
0 commit comments