@@ -198,8 +198,9 @@ type vals_and_bindings<V:copy, T:copy> = {
198
198
199
199
enum infer_ctxt = @{
200
200
tcx: ty:: ctxt,
201
- vb: vals_and_bindings <ty:: ty_vid , ty:: t >,
202
- rb: vals_and_bindings<ty:: region_vid, ty:: region>,
201
+ tvb: vals_and_bindings <ty:: ty_vid , ty:: t >, // for type variables
202
+ tvib: vals_and_bindings<ty:: ty_vid, ty:: t>, // for integral type variables
203
+ rb: vals_and_bindings<ty:: region_vid, ty:: region>, // for region variables
203
204
204
205
// For keeping track of existing type/region variables.
205
206
ty_var_counter: @mut uint,
@@ -227,7 +228,8 @@ type fres<T> = result::result<T, fixup_err>;
227
228
228
229
fn new_infer_ctxt ( tcx : ty:: ctxt ) -> infer_ctxt {
229
230
infer_ctxt ( @{ tcx: tcx,
230
- vb : { vals : smallintmap:: mk ( ) , mut bindings : [ ] } ,
231
+ tvb : { vals : smallintmap:: mk ( ) , mut bindings : [ ] } ,
232
+ tvib : { vals : smallintmap:: mk ( ) , mut bindings : [ ] } ,
231
233
rb : { vals : smallintmap:: mk ( ) , mut bindings : [ ] } ,
232
234
ty_var_counter: @mut 0 u,
233
235
region_var_counter: @mut 0 u} ) }
@@ -423,14 +425,14 @@ impl transaction_methods for infer_ctxt {
423
425
#[ doc = "Execute `f` and commit the bindings if successful" ]
424
426
fn commit < T , E > ( f : fn ( ) -> result < T , E > ) -> result < T , E > {
425
427
426
- assert self. vb . bindings . len ( ) == 0 u;
428
+ assert self. tvb . bindings . len ( ) == 0 u;
427
429
assert self. rb . bindings . len ( ) == 0 u;
428
430
429
431
let r <- self . try( f ) ;
430
432
431
433
// TODO---could use a vec::clear() that ran destructors but kept
432
434
// the vec at its currently allocated length
433
- self . vb . bindings = [ ] ;
435
+ self . tvb . bindings = [ ] ;
434
436
self . rb . bindings = [ ] ;
435
437
436
438
ret r;
@@ -439,15 +441,15 @@ impl transaction_methods for infer_ctxt {
439
441
#[ doc = "Execute `f`, unroll bindings on failure" ]
440
442
fn try < T , E > ( f : fn ( ) -> result < T , E > ) -> result < T , E > {
441
443
442
- let vbl = self . vb . bindings . len ( ) ;
444
+ let tvbl = self . tvb . bindings . len ( ) ;
443
445
let rbl = self . rb . bindings . len ( ) ;
444
- #debug[ "try(vbl =%u, rbl=%u)" , vbl , rbl] ;
446
+ #debug[ "try(tvbl =%u, rbl=%u)" , tvbl , rbl] ;
445
447
let r < - f ( ) ;
446
448
alt r {
447
449
result:: ok ( _) { #debug[ "try--ok" ] ; }
448
450
result:: err ( _) {
449
451
#debug[ "try--rollback" ] ;
450
- rollback_to ( self . vb , vbl ) ;
452
+ rollback_to ( self . tvb , tvbl ) ;
451
453
rollback_to ( self . rb , rbl) ;
452
454
}
453
455
}
@@ -456,10 +458,10 @@ impl transaction_methods for infer_ctxt {
456
458
457
459
#[ doc = "Execute `f` then unroll any bindings it creates" ]
458
460
fn probe < T , E > ( f : fn ( ) -> result < T , E > ) -> result < T , E > {
459
- assert self. vb . bindings . len ( ) == 0 u;
461
+ assert self. tvb . bindings . len ( ) == 0 u;
460
462
assert self. rb . bindings . len ( ) == 0 u;
461
463
let r < - f ( ) ;
462
- rollback_to ( self . vb , 0 u ) ;
464
+ rollback_to ( self . tvb , 0 u ) ;
463
465
rollback_to ( self . rb, 0 u ) ;
464
466
ret r;
465
467
}
@@ -932,7 +934,7 @@ impl methods for resolve_state {
932
934
// tend to carry more restrictions or higher
933
935
// perf. penalties, so it pays to know more.
934
936
935
- let { root: _, bounds} = self . infcx. get( self . infcx. vb , vid) ;
937
+ let { root: _, bounds} = self . infcx. get( self . infcx. tvb , vid) ;
936
938
let t1 = alt bounds {
937
939
{ ub : _, lb : some( t) } if !type_is_bot( t) { self . resolve1( t) }
938
940
{ ub: some( t) , lb: _ } { self . resolve1( t) }
@@ -1025,21 +1027,21 @@ impl assignment for infer_ctxt {
1025
1027
}
1026
1028
1027
1029
( ty:: ty_var( a_id) , ty:: ty_var( b_id) ) {
1028
- let { root: _, bounds: a_bounds} = self . get( self . vb , a_id) ;
1029
- let { root: _, bounds: b_bounds} = self . get( self . vb , b_id) ;
1030
+ let { root: _, bounds: a_bounds} = self . get( self . tvb , a_id) ;
1031
+ let { root: _, bounds: b_bounds} = self . get( self . tvb , b_id) ;
1030
1032
let a_bnd = select( a_bounds. ub, a_bounds. lb) ;
1031
1033
let b_bnd = select( b_bounds. lb, b_bounds. ub) ;
1032
1034
self . assign_tys_or_sub( anmnt, a, b, a_bnd, b_bnd)
1033
1035
}
1034
1036
1035
1037
( ty:: ty_var( a_id) , _) {
1036
- let { root: _, bounds: a_bounds} = self . get( self . vb , a_id) ;
1038
+ let { root: _, bounds: a_bounds} = self . get( self . tvb , a_id) ;
1037
1039
let a_bnd = select( a_bounds. ub, a_bounds. lb) ;
1038
1040
self . assign_tys_or_sub( anmnt, a, b, a_bnd, some( b) )
1039
1041
}
1040
1042
1041
1043
( _, ty:: ty_var( b_id) ) {
1042
- let { root: _, bounds: b_bounds} = self . get( self . vb , b_id) ;
1044
+ let { root: _, bounds: b_bounds} = self . get( self . tvb , b_id) ;
1043
1045
let b_bnd = select( b_bounds. lb, b_bounds. ub) ;
1044
1046
self . assign_tys_or_sub( anmnt, a, b, some( a) , b_bnd)
1045
1047
}
@@ -1632,13 +1634,13 @@ impl of combine for sub {
1632
1634
ok( a)
1633
1635
}
1634
1636
( ty:: ty_var( a_id) , ty:: ty_var( b_id) ) {
1635
- self . infcx( ) . vars( self . vb , a_id, b_id) . then { || ok( a) }
1637
+ self . infcx( ) . vars( self . tvb , a_id, b_id) . then { || ok( a) }
1636
1638
}
1637
1639
( ty:: ty_var( a_id) , _) {
1638
- self . infcx( ) . vart( self . vb , a_id, b) . then { || ok( a) }
1640
+ self . infcx( ) . vart( self . tvb , a_id, b) . then { || ok( a) }
1639
1641
}
1640
1642
( _, ty:: ty_var( b_id) ) {
1641
- self . infcx( ) . tvar( self . vb , a, b_id) . then { || ok( a) }
1643
+ self . infcx( ) . tvar( self . tvb , a, b_id) . then { || ok( a) }
1642
1644
}
1643
1645
( _, ty:: ty_bot) {
1644
1646
err( ty:: terr_sorts( b, a) )
@@ -2148,18 +2150,18 @@ fn lattice_tys<L:lattice_ops combine>(
2148
2150
( _, ty:: ty_bot) { self . ty_bot( a) }
2149
2151
2150
2152
( ty:: ty_var( a_id) , ty:: ty_var( b_id) ) {
2151
- lattice_vars( self , self . infcx( ) . vb ,
2153
+ lattice_vars( self , self . infcx( ) . tvb ,
2152
2154
a, a_id, b_id,
2153
2155
{ |x, y| self . tys( x, y) } )
2154
2156
}
2155
2157
2156
2158
( ty:: ty_var( a_id) , _) {
2157
- lattice_var_t( self , self . infcx( ) . vb , a_id, b,
2159
+ lattice_var_t( self , self . infcx( ) . tvb , a_id, b,
2158
2160
{ |x, y| self . tys( x, y) } )
2159
2161
}
2160
2162
2161
2163
( _, ty:: ty_var( b_id) ) {
2162
- lattice_var_t( self , self . infcx( ) . vb , b_id, a,
2164
+ lattice_var_t( self , self . infcx( ) . tvb , b_id, a,
2163
2165
{ |x, y| self . tys( x, y) } )
2164
2166
}
2165
2167
0 commit comments