use ty::TyVar;
use ty::relate::{Relate, RelateResult, TypeRelation};
-pub struct Bivariate<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
- fields: CombineFields<'a, 'gcx, 'tcx>
+pub struct Bivariate<'infcx, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
+ fields: CombineFields<'infcx, 'gcx, 'tcx>
}
-impl<'a, 'gcx, 'tcx> Bivariate<'a, 'gcx, 'tcx> {
- pub fn new(fields: CombineFields<'a, 'gcx, 'tcx>) -> Bivariate<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> Bivariate<'infcx, 'gcx, 'tcx> {
+ pub fn new(fields: CombineFields<'infcx, 'gcx, 'tcx>) -> Bivariate<'infcx, 'gcx, 'tcx> {
Bivariate { fields: fields }
}
}
-impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Bivariate<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Bivariate<'infcx, 'gcx, 'tcx> {
fn tag(&self) -> &'static str { "Bivariate" }
- fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { self.fields.tcx() }
+ fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
use syntax_pos::Span;
#[derive(Clone)]
-pub struct CombineFields<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
- pub infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
+pub struct CombineFields<'infcx, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
+ pub infcx: &'infcx InferCtxt<'infcx, 'gcx, 'tcx>,
pub a_is_expected: bool,
pub trace: TypeTrace<'tcx>,
pub cause: Option<ty::relate::Cause>,
pub obligations: PredicateObligations<'tcx>,
}
-impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
pub fn super_combine_tys<R>(&self,
relation: &mut R,
a: Ty<'tcx>,
b: Ty<'tcx>)
-> RelateResult<'tcx, Ty<'tcx>>
- where R: TypeRelation<'a, 'gcx, 'tcx>
+ where R: TypeRelation<'infcx, 'gcx, 'tcx>
{
let a_is_expected = relation.a_is_expected();
}
}
-impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
- pub fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> {
+ pub fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> {
self.infcx.tcx
}
- pub fn switch_expected(&self) -> CombineFields<'a, 'gcx, 'tcx> {
+ pub fn switch_expected(&self) -> CombineFields<'infcx, 'gcx, 'tcx> {
CombineFields {
a_is_expected: !self.a_is_expected,
..(*self).clone()
}
}
- pub fn equate(&self) -> Equate<'a, 'gcx, 'tcx> {
+ pub fn equate(&self) -> Equate<'infcx, 'gcx, 'tcx> {
Equate::new(self.clone())
}
- pub fn bivariate(&self) -> Bivariate<'a, 'gcx, 'tcx> {
+ pub fn bivariate(&self) -> Bivariate<'infcx, 'gcx, 'tcx> {
Bivariate::new(self.clone())
}
- pub fn sub(&self) -> Sub<'a, 'gcx, 'tcx> {
+ pub fn sub(&self) -> Sub<'infcx, 'gcx, 'tcx> {
Sub::new(self.clone())
}
- pub fn lub(&self) -> Lub<'a, 'gcx, 'tcx> {
+ pub fn lub(&self) -> Lub<'infcx, 'gcx, 'tcx> {
Lub::new(self.clone())
}
- pub fn glb(&self) -> Glb<'a, 'gcx, 'tcx> {
+ pub fn glb(&self) -> Glb<'infcx, 'gcx, 'tcx> {
Glb::new(self.clone())
}
use traits::PredicateObligations;
/// Ensures `a` is made equal to `b`. Returns `a` on success.
-pub struct Equate<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
- fields: CombineFields<'a, 'gcx, 'tcx>
+pub struct Equate<'infcx, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
+ fields: CombineFields<'infcx, 'gcx, 'tcx>
}
-impl<'a, 'gcx, 'tcx> Equate<'a, 'gcx, 'tcx> {
- pub fn new(fields: CombineFields<'a, 'gcx, 'tcx>) -> Equate<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> Equate<'infcx, 'gcx, 'tcx> {
+ pub fn new(fields: CombineFields<'infcx, 'gcx, 'tcx>) -> Equate<'infcx, 'gcx, 'tcx> {
Equate { fields: fields }
}
}
}
-impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Equate<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Equate<'infcx, 'gcx, 'tcx> {
fn tag(&self) -> &'static str { "Equate" }
- fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { self.fields.tcx() }
+ fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
use traits::PredicateObligations;
/// "Greatest lower bound" (common subtype)
-pub struct Glb<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
- fields: CombineFields<'a, 'gcx, 'tcx>
+pub struct Glb<'infcx, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
+ fields: CombineFields<'infcx, 'gcx, 'tcx>
}
-impl<'a, 'gcx, 'tcx> Glb<'a, 'gcx, 'tcx> {
- pub fn new(fields: CombineFields<'a, 'gcx, 'tcx>) -> Glb<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> Glb<'infcx, 'gcx, 'tcx> {
+ pub fn new(fields: CombineFields<'infcx, 'gcx, 'tcx>) -> Glb<'infcx, 'gcx, 'tcx> {
Glb { fields: fields }
}
}
}
-impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Glb<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Glb<'infcx, 'gcx, 'tcx> {
fn tag(&self) -> &'static str { "Glb" }
- fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { self.fields.tcx() }
+ fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
}
}
-impl<'a, 'gcx, 'tcx> LatticeDir<'a, 'gcx, 'tcx> for Glb<'a, 'gcx, 'tcx> {
- fn infcx(&self) -> &'a InferCtxt<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx> for Glb<'infcx, 'gcx, 'tcx> {
+ fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
self.fields.infcx
}
use traits::PredicateObligations;
/// "Least upper bound" (common supertype)
-pub struct Lub<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
- fields: CombineFields<'a, 'gcx, 'tcx>
+pub struct Lub<'infcx, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
+ fields: CombineFields<'infcx, 'gcx, 'tcx>
}
-impl<'a, 'gcx, 'tcx> Lub<'a, 'gcx, 'tcx> {
- pub fn new(fields: CombineFields<'a, 'gcx, 'tcx>) -> Lub<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> Lub<'infcx, 'gcx, 'tcx> {
+ pub fn new(fields: CombineFields<'infcx, 'gcx, 'tcx>) -> Lub<'infcx, 'gcx, 'tcx> {
Lub { fields: fields }
}
}
}
-impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Lub<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Lub<'infcx, 'gcx, 'tcx> {
fn tag(&self) -> &'static str { "Lub" }
- fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { self.fields.tcx() }
+ fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
}
}
-impl<'a, 'gcx, 'tcx> LatticeDir<'a, 'gcx, 'tcx> for Lub<'a, 'gcx, 'tcx> {
- fn infcx(&self) -> &'a InferCtxt<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx> for Lub<'infcx, 'gcx, 'tcx> {
+ fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
self.fields.infcx
}
use std::mem;
/// Ensures `a` is made a subtype of `b`. Returns `a` on success.
-pub struct Sub<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
- fields: CombineFields<'a, 'gcx, 'tcx>,
+pub struct Sub<'infcx, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
+ fields: CombineFields<'infcx, 'gcx, 'tcx>,
}
-impl<'a, 'gcx, 'tcx> Sub<'a, 'gcx, 'tcx> {
- pub fn new(f: CombineFields<'a, 'gcx, 'tcx>) -> Sub<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> Sub<'infcx, 'gcx, 'tcx> {
+ pub fn new(f: CombineFields<'infcx, 'gcx, 'tcx>) -> Sub<'infcx, 'gcx, 'tcx> {
Sub { fields: f }
}
}
}
-impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Sub<'a, 'gcx, 'tcx> {
+impl<'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Sub<'infcx, 'gcx, 'tcx> {
fn tag(&self) -> &'static str { "Sub" }
- fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { self.fields.infcx.tcx }
+ fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.infcx.tcx }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
fn with_cause<F,R>(&mut self, cause: Cause, f: F) -> R