@@ -121,7 +121,7 @@ pub trait Combine {
121
121
for & space in subst:: ParamSpace :: all ( ) . iter ( ) {
122
122
let a_tps = a_subst. types . get_slice ( space) ;
123
123
let b_tps = b_subst. types . get_slice ( space) ;
124
- let tps = if_ok ! ( self . tps( space, a_tps, b_tps) ) ;
124
+ let tps = try !( self . tps ( space, a_tps, b_tps) ) ;
125
125
126
126
let a_regions = a_subst. regions ( ) . get_slice ( space) ;
127
127
let b_regions = b_subst. regions ( ) . get_slice ( space) ;
@@ -137,11 +137,11 @@ pub trait Combine {
137
137
}
138
138
} ;
139
139
140
- let regions = if_ok ! ( relate_region_params( self ,
141
- item_def_id,
142
- r_variances,
143
- a_regions,
144
- b_regions) ) ;
140
+ let regions = try !( relate_region_params ( self ,
141
+ item_def_id,
142
+ r_variances,
143
+ a_regions,
144
+ b_regions) ) ;
145
145
146
146
substs. types . replace ( space, tps) ;
147
147
substs. mut_regions ( ) . replace ( space, regions) ;
@@ -185,17 +185,17 @@ pub trait Combine {
185
185
ty:: Contravariant => this. contraregions ( a_r, b_r) ,
186
186
ty:: Bivariant => Ok ( a_r) ,
187
187
} ;
188
- rs. push ( if_ok ! ( r) ) ;
188
+ rs. push ( try !( r) ) ;
189
189
}
190
190
Ok ( rs)
191
191
}
192
192
}
193
193
194
194
fn bare_fn_tys ( & self , a : & ty:: BareFnTy ,
195
195
b : & ty:: BareFnTy ) -> cres < ty:: BareFnTy > {
196
- let fn_style = if_ok ! ( self . fn_styles( a. fn_style, b. fn_style) ) ;
197
- let abi = if_ok ! ( self . abi( a. abi, b. abi) ) ;
198
- let sig = if_ok ! ( self . fn_sigs( & a. sig, & b. sig) ) ;
196
+ let fn_style = try !( self . fn_styles ( a. fn_style , b. fn_style ) ) ;
197
+ let abi = try !( self . abi ( a. abi , b. abi ) ) ;
198
+ let sig = try !( self . fn_sigs ( & a. sig , & b. sig ) ) ;
199
199
Ok ( ty:: BareFnTy { fn_style : fn_style,
200
200
abi : abi,
201
201
sig : sig} )
@@ -207,7 +207,7 @@ pub trait Combine {
207
207
let store = match ( a. store , b. store ) {
208
208
( ty:: RegionTraitStore ( a_r, a_m) ,
209
209
ty:: RegionTraitStore ( b_r, b_m) ) if a_m == b_m => {
210
- let r = if_ok ! ( self . contraregions( a_r, b_r) ) ;
210
+ let r = try !( self . contraregions ( a_r, b_r) ) ;
211
211
ty:: RegionTraitStore ( r, a_m)
212
212
}
213
213
@@ -219,11 +219,11 @@ pub trait Combine {
219
219
return Err ( ty:: terr_sigil_mismatch ( expected_found ( self , a. store , b. store ) ) )
220
220
}
221
221
} ;
222
- let fn_style = if_ok ! ( self . fn_styles( a. fn_style, b. fn_style) ) ;
223
- let onceness = if_ok ! ( self . oncenesses( a. onceness, b. onceness) ) ;
224
- let bounds = if_ok ! ( self . existential_bounds( a. bounds, b. bounds) ) ;
225
- let sig = if_ok ! ( self . fn_sigs( & a. sig, & b. sig) ) ;
226
- let abi = if_ok ! ( self . abi( a. abi, b. abi) ) ;
222
+ let fn_style = try !( self . fn_styles ( a. fn_style , b. fn_style ) ) ;
223
+ let onceness = try !( self . oncenesses ( a. onceness , b. onceness ) ) ;
224
+ let bounds = try !( self . existential_bounds ( a. bounds , b. bounds ) ) ;
225
+ let sig = try !( self . fn_sigs ( & a. sig , & b. sig ) ) ;
226
+ let abi = try !( self . abi ( a. abi , b. abi ) ) ;
227
227
Ok ( ty:: ClosureTy {
228
228
fn_style : fn_style,
229
229
onceness : onceness,
@@ -311,7 +311,7 @@ pub trait Combine {
311
311
Err ( ty:: terr_traits (
312
312
expected_found ( self , a. def_id , b. def_id ) ) )
313
313
} else {
314
- let substs = if_ok ! ( self . substs( a. def_id, & a. substs, & b. substs) ) ;
314
+ let substs = try !( self . substs ( a. def_id , & a. substs , & b. substs ) ) ;
315
315
Ok ( ty:: TraitRef { def_id : a. def_id ,
316
316
substs : substs } )
317
317
}
@@ -377,10 +377,10 @@ pub fn super_fn_sigs<C:Combine>(this: &C, a: &ty::FnSig, b: &ty::FnSig) -> cres<
377
377
return Err ( ty:: terr_variadic_mismatch ( expected_found ( this, a. variadic , b. variadic ) ) ) ;
378
378
}
379
379
380
- let inputs = if_ok ! ( argvecs( this,
380
+ let inputs = try !( argvecs ( this,
381
381
a. inputs . as_slice ( ) ,
382
382
b. inputs . as_slice ( ) ) ) ;
383
- let output = if_ok ! ( this. tys( a. output, b. output) ) ;
383
+ let output = try !( this. tys ( a. output , b. output ) ) ;
384
384
Ok ( FnSig { binder_id : a. binder_id ,
385
385
inputs : inputs,
386
386
output : output,
@@ -430,7 +430,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
430
430
431
431
// Relate integral variables to other types
432
432
( & ty:: ty_infer( IntVar ( a_id) ) , & ty:: ty_infer( IntVar ( b_id) ) ) => {
433
- if_ok ! ( this. infcx( ) . simple_vars( this. a_is_expected( ) ,
433
+ try !( this. infcx ( ) . simple_vars ( this. a_is_expected ( ) ,
434
434
a_id, b_id) ) ;
435
435
Ok ( a)
436
436
}
@@ -453,7 +453,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
453
453
454
454
// Relate floating-point variables to other types
455
455
( & ty:: ty_infer( FloatVar ( a_id) ) , & ty:: ty_infer( FloatVar ( b_id) ) ) => {
456
- if_ok ! ( this. infcx( ) . simple_vars( this. a_is_expected( ) ,
456
+ try !( this. infcx ( ) . simple_vars ( this. a_is_expected ( ) ,
457
457
a_id, b_id) ) ;
458
458
Ok ( a)
459
459
}
@@ -485,7 +485,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
485
485
( & ty:: ty_enum( a_id, ref a_substs) ,
486
486
& ty:: ty_enum( b_id, ref b_substs) )
487
487
if a_id == b_id => {
488
- let substs = if_ok ! ( this. substs( a_id,
488
+ let substs = try !( this. substs ( a_id,
489
489
a_substs,
490
490
b_substs) ) ;
491
491
Ok ( ty:: mk_enum ( tcx, a_id, substs) )
@@ -495,8 +495,8 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
495
495
& ty:: ty_trait( ref b_) )
496
496
if a_. def_id == b_. def_id => {
497
497
debug ! ( "Trying to match traits {:?} and {:?}" , a, b) ;
498
- let substs = if_ok ! ( this. substs( a_. def_id, & a_. substs, & b_. substs) ) ;
499
- let bounds = if_ok ! ( this. existential_bounds( a_. bounds, b_. bounds) ) ;
498
+ let substs = try !( this. substs ( a_. def_id , & a_. substs , & b_. substs ) ) ;
499
+ let bounds = try !( this. existential_bounds ( a_. bounds , b_. bounds ) ) ;
500
500
Ok ( ty:: mk_trait ( tcx,
501
501
a_. def_id ,
502
502
substs. clone ( ) ,
@@ -505,7 +505,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
505
505
506
506
( & ty:: ty_struct( a_id, ref a_substs) , & ty:: ty_struct( b_id, ref b_substs) )
507
507
if a_id == b_id => {
508
- let substs = if_ok ! ( this. substs( a_id, a_substs, b_substs) ) ;
508
+ let substs = try !( this. substs ( a_id, a_substs, b_substs) ) ;
509
509
Ok ( ty:: mk_struct ( tcx, a_id, substs) )
510
510
}
511
511
@@ -521,27 +521,27 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
521
521
}
522
522
523
523
( & ty:: ty_uniq( a_inner) , & ty:: ty_uniq( b_inner) ) => {
524
- let typ = if_ok ! ( this. tys( a_inner, b_inner) ) ;
524
+ let typ = try !( this. tys ( a_inner, b_inner) ) ;
525
525
check_ptr_to_unsized ( this, a, b, a_inner, b_inner, ty:: mk_uniq ( tcx, typ) )
526
526
}
527
527
528
528
( & ty:: ty_ptr( ref a_mt) , & ty:: ty_ptr( ref b_mt) ) => {
529
- let mt = if_ok ! ( this. mts( a_mt, b_mt) ) ;
529
+ let mt = try !( this. mts ( a_mt, b_mt) ) ;
530
530
check_ptr_to_unsized ( this, a, b, a_mt. ty , b_mt. ty , ty:: mk_ptr ( tcx, mt) )
531
531
}
532
532
533
533
( & ty:: ty_rptr( a_r, ref a_mt) , & ty:: ty_rptr( b_r, ref b_mt) ) => {
534
- let r = if_ok ! ( this. contraregions( a_r, b_r) ) ;
534
+ let r = try !( this. contraregions ( a_r, b_r) ) ;
535
535
// FIXME(14985) If we have mutable references to trait objects, we
536
536
// used to use covariant subtyping. I have preserved this behaviour,
537
537
// even though it is probably incorrect. So don't go down the usual
538
538
// path which would require invariance.
539
539
let mt = match ( & ty:: get ( a_mt. ty ) . sty , & ty:: get ( b_mt. ty ) . sty ) {
540
540
( & ty:: ty_trait( ..) , & ty:: ty_trait( ..) ) if a_mt. mutbl == b_mt. mutbl => {
541
- let ty = if_ok ! ( this. tys( a_mt. ty, b_mt. ty) ) ;
541
+ let ty = try !( this. tys ( a_mt. ty , b_mt. ty ) ) ;
542
542
ty:: mt { ty : ty, mutbl : a_mt. mutbl }
543
543
}
544
- _ => if_ok ! ( this. mts( a_mt, b_mt) )
544
+ _ => try !( this. mts ( a_mt, b_mt) )
545
545
} ;
546
546
check_ptr_to_unsized ( this, a, b, a_mt. ty , b_mt. ty , ty:: mk_rptr ( tcx, r, mt) )
547
547
}
@@ -592,7 +592,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
592
592
vid : ty:: IntVid ,
593
593
val : ty:: IntVarValue ) -> cres < ty:: t >
594
594
{
595
- if_ok ! ( this. infcx( ) . simple_var_t( vid_is_expected, vid, val) ) ;
595
+ try !( this. infcx ( ) . simple_var_t ( vid_is_expected, vid, val) ) ;
596
596
match val {
597
597
IntType ( v) => Ok ( ty:: mk_mach_int ( v) ) ,
598
598
UintType ( v) => Ok ( ty:: mk_mach_uint ( v) )
@@ -605,7 +605,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
605
605
vid : ty:: FloatVid ,
606
606
val : ast:: FloatTy ) -> cres < ty:: t >
607
607
{
608
- if_ok ! ( this. infcx( ) . simple_var_t( vid_is_expected, vid, val) ) ;
608
+ try !( this. infcx ( ) . simple_var_t ( vid_is_expected, vid, val) ) ;
609
609
Ok ( ty:: mk_mach_float ( val) )
610
610
}
611
611
}
0 commit comments