Skip to content

Commit 686eef0

Browse files
committed
---
yaml --- r: 129965 b: refs/heads/snap-stage3 c: 790d9c4 h: refs/heads/master i: 129963: 7ad096b v: v3
1 parent 7685fb8 commit 686eef0

File tree

9 files changed

+144
-132
lines changed

9 files changed

+144
-132
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0bdac78da87605f6f7f6e7924872617226b19c85
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: ae314512e381f5a7ae5a798fd613125720214829
4+
refs/heads/snap-stage3: 790d9c47081c9ddffaad096239e0dfee2f2d10a6
55
refs/heads/try: 28d5878c1f0465c11c8e7a3085008b0c592d48d0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use middle::subst::{Subst, Substs, VecPerParamSpace};
3030
use middle::subst;
3131
use middle::ty;
3232
use middle::typeck;
33-
use middle::typeck::MethodCall;
3433
use middle::ty_fold;
3534
use middle::ty_fold::{TypeFoldable,TypeFolder};
3635
use middle;

branches/snap-stage3/src/librustc/middle/typeck/infer/coercion.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<'f> Coerce<'f> {
247247
let a_borrowed = ty::mk_rptr(self.get_ref().infcx.tcx,
248248
r_borrow,
249249
mt {ty: inner_ty, mutbl: mutbl_b});
250-
if_ok!(sub.tys(a_borrowed, b));
250+
try!(sub.tys(a_borrowed, b));
251251

252252
Ok(Some(AutoDerefRef(AutoDerefRef {
253253
autoderefs: 1,
@@ -273,7 +273,7 @@ impl<'f> Coerce<'f> {
273273
let r_borrow = self.get_ref().infcx.next_region_var(coercion);
274274
let unsized_ty = ty::mk_slice(self.get_ref().infcx.tcx, r_borrow,
275275
mt {ty: t_a, mutbl: mutbl_b});
276-
if_ok!(self.get_ref().infcx.try(|| sub.tys(unsized_ty, b)));
276+
try!(self.get_ref().infcx.try(|| sub.tys(unsized_ty, b)));
277277
Ok(Some(AutoDerefRef(AutoDerefRef {
278278
autoderefs: 0,
279279
autoref: Some(ty::AutoPtr(r_borrow,
@@ -316,7 +316,7 @@ impl<'f> Coerce<'f> {
316316
let ty = ty::mk_rptr(self.get_ref().infcx.tcx,
317317
r_borrow,
318318
ty::mt{ty: ty, mutbl: mt_b.mutbl});
319-
if_ok!(self.get_ref().infcx.try(|| sub.tys(ty, b)));
319+
try!(self.get_ref().infcx.try(|| sub.tys(ty, b)));
320320
debug!("Success, coerced with AutoDerefRef(1, \
321321
AutoPtr(AutoUnsize({:?})))", kind);
322322
Ok(Some(AutoDerefRef(AutoDerefRef {
@@ -334,7 +334,7 @@ impl<'f> Coerce<'f> {
334334
match self.unsize_ty(sty_a, t_b) {
335335
Some((ty, kind)) => {
336336
let ty = ty::mk_uniq(self.get_ref().infcx.tcx, ty);
337-
if_ok!(self.get_ref().infcx.try(|| sub.tys(ty, b)));
337+
try!(self.get_ref().infcx.try(|| sub.tys(ty, b)));
338338
debug!("Success, coerced with AutoDerefRef(1, \
339339
AutoUnsizeUniq({:?}))", kind);
340340
Ok(Some(AutoDerefRef(AutoDerefRef {
@@ -458,7 +458,7 @@ impl<'f> Coerce<'f> {
458458
}
459459
};
460460

461-
if_ok!(self.subtype(a_borrowed, b));
461+
try!(self.subtype(a_borrowed, b));
462462
Ok(Some(AutoDerefRef(AutoDerefRef {
463463
autoderefs: 1,
464464
autoref: Some(AutoPtr(r_a, b_mutbl, None))
@@ -512,7 +512,7 @@ impl<'f> Coerce<'f> {
512512
sig: fn_ty_a.sig.clone(),
513513
.. *fn_ty_b
514514
});
515-
if_ok!(self.subtype(a_closure, b));
515+
try!(self.subtype(a_closure, b));
516516
Ok(Some(adj))
517517
})
518518
}
@@ -536,7 +536,7 @@ impl<'f> Coerce<'f> {
536536

537537
// check that the types which they point at are compatible
538538
let a_unsafe = ty::mk_ptr(self.get_ref().infcx.tcx, mt_a);
539-
if_ok!(self.subtype(a_unsafe, b));
539+
try!(self.subtype(a_unsafe, b));
540540

541541
// although references and unsafe ptrs have the same
542542
// representation, we still register an AutoDerefRef so that

branches/snap-stage3/src/librustc/middle/typeck/infer/combine.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub trait Combine {
121121
for &space in subst::ParamSpace::all().iter() {
122122
let a_tps = a_subst.types.get_slice(space);
123123
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));
125125

126126
let a_regions = a_subst.regions().get_slice(space);
127127
let b_regions = b_subst.regions().get_slice(space);
@@ -137,11 +137,11 @@ pub trait Combine {
137137
}
138138
};
139139

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));
145145

146146
substs.types.replace(space, tps);
147147
substs.mut_regions().replace(space, regions);
@@ -185,17 +185,17 @@ pub trait Combine {
185185
ty::Contravariant => this.contraregions(a_r, b_r),
186186
ty::Bivariant => Ok(a_r),
187187
};
188-
rs.push(if_ok!(r));
188+
rs.push(try!(r));
189189
}
190190
Ok(rs)
191191
}
192192
}
193193

194194
fn bare_fn_tys(&self, a: &ty::BareFnTy,
195195
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));
199199
Ok(ty::BareFnTy {fn_style: fn_style,
200200
abi: abi,
201201
sig: sig})
@@ -207,7 +207,7 @@ pub trait Combine {
207207
let store = match (a.store, b.store) {
208208
(ty::RegionTraitStore(a_r, a_m),
209209
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));
211211
ty::RegionTraitStore(r, a_m)
212212
}
213213

@@ -219,11 +219,11 @@ pub trait Combine {
219219
return Err(ty::terr_sigil_mismatch(expected_found(self, a.store, b.store)))
220220
}
221221
};
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));
227227
Ok(ty::ClosureTy {
228228
fn_style: fn_style,
229229
onceness: onceness,
@@ -311,7 +311,7 @@ pub trait Combine {
311311
Err(ty::terr_traits(
312312
expected_found(self, a.def_id, b.def_id)))
313313
} 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));
315315
Ok(ty::TraitRef { def_id: a.def_id,
316316
substs: substs })
317317
}
@@ -377,10 +377,10 @@ pub fn super_fn_sigs<C:Combine>(this: &C, a: &ty::FnSig, b: &ty::FnSig) -> cres<
377377
return Err(ty::terr_variadic_mismatch(expected_found(this, a.variadic, b.variadic)));
378378
}
379379

380-
let inputs = if_ok!(argvecs(this,
380+
let inputs = try!(argvecs(this,
381381
a.inputs.as_slice(),
382382
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));
384384
Ok(FnSig {binder_id: a.binder_id,
385385
inputs: inputs,
386386
output: output,
@@ -430,7 +430,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
430430

431431
// Relate integral variables to other types
432432
(&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(),
434434
a_id, b_id));
435435
Ok(a)
436436
}
@@ -453,7 +453,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
453453

454454
// Relate floating-point variables to other types
455455
(&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(),
457457
a_id, b_id));
458458
Ok(a)
459459
}
@@ -485,7 +485,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
485485
(&ty::ty_enum(a_id, ref a_substs),
486486
&ty::ty_enum(b_id, ref b_substs))
487487
if a_id == b_id => {
488-
let substs = if_ok!(this.substs(a_id,
488+
let substs = try!(this.substs(a_id,
489489
a_substs,
490490
b_substs));
491491
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> {
495495
&ty::ty_trait(ref b_))
496496
if a_.def_id == b_.def_id => {
497497
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));
500500
Ok(ty::mk_trait(tcx,
501501
a_.def_id,
502502
substs.clone(),
@@ -505,7 +505,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
505505

506506
(&ty::ty_struct(a_id, ref a_substs), &ty::ty_struct(b_id, ref b_substs))
507507
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));
509509
Ok(ty::mk_struct(tcx, a_id, substs))
510510
}
511511

@@ -521,27 +521,27 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
521521
}
522522

523523
(&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));
525525
check_ptr_to_unsized(this, a, b, a_inner, b_inner, ty::mk_uniq(tcx, typ))
526526
}
527527

528528
(&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));
530530
check_ptr_to_unsized(this, a, b, a_mt.ty, b_mt.ty, ty::mk_ptr(tcx, mt))
531531
}
532532

533533
(&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));
535535
// FIXME(14985) If we have mutable references to trait objects, we
536536
// used to use covariant subtyping. I have preserved this behaviour,
537537
// even though it is probably incorrect. So don't go down the usual
538538
// path which would require invariance.
539539
let mt = match (&ty::get(a_mt.ty).sty, &ty::get(b_mt.ty).sty) {
540540
(&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));
542542
ty::mt { ty: ty, mutbl: a_mt.mutbl }
543543
}
544-
_ => if_ok!(this.mts(a_mt, b_mt))
544+
_ => try!(this.mts(a_mt, b_mt))
545545
};
546546
check_ptr_to_unsized(this, a, b, a_mt.ty, b_mt.ty, ty::mk_rptr(tcx, r, mt))
547547
}
@@ -592,7 +592,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
592592
vid: ty::IntVid,
593593
val: ty::IntVarValue) -> cres<ty::t>
594594
{
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));
596596
match val {
597597
IntType(v) => Ok(ty::mk_mach_int(v)),
598598
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> {
605605
vid: ty::FloatVid,
606606
val: ast::FloatTy) -> cres<ty::t>
607607
{
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));
609609
Ok(ty::mk_mach_float(val))
610610
}
611611
}

0 commit comments

Comments
 (0)