Skip to content

Commit

Permalink
Rename infcx lifetimes in inference relations
Browse files Browse the repository at this point in the history
  • Loading branch information
soltanmm-google committed Jul 25, 2016
1 parent cdb0867 commit 5e39032
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
12 changes: 6 additions & 6 deletions src/librustc/infer/bivariate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ use ty::{self, Ty, TyCtxt};
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 }

Expand Down
24 changes: 12 additions & 12 deletions src/librustc/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ use syntax::ast;
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();

Expand Down Expand Up @@ -150,35 +150,35 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}

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())
}

Expand Down
12 changes: 6 additions & 6 deletions src/librustc/infer/equate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ use ty::relate::{Relate, RelateResult, TypeRelation};
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 }
}

Expand All @@ -32,10 +32,10 @@ impl<'a, 'gcx, 'tcx> Equate<'a, 'gcx, 'tcx> {
}
}

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 }

Expand Down
16 changes: 8 additions & 8 deletions src/librustc/infer/glb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ use ty::relate::{Relate, RelateResult, TypeRelation};
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 }
}

Expand All @@ -32,10 +32,10 @@ impl<'a, 'gcx, 'tcx> Glb<'a, 'gcx, 'tcx> {
}
}

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 }

Expand Down Expand Up @@ -75,8 +75,8 @@ impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Glb<'a, 'gcx, 'tcx> {
}
}

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
}

Expand Down
16 changes: 8 additions & 8 deletions src/librustc/infer/lub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ use ty::relate::{Relate, RelateResult, TypeRelation};
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 }
}

Expand All @@ -32,10 +32,10 @@ impl<'a, 'gcx, 'tcx> Lub<'a, 'gcx, 'tcx> {
}
}

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 }

Expand Down Expand Up @@ -75,8 +75,8 @@ impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Lub<'a, 'gcx, 'tcx> {
}
}

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
}

Expand Down
12 changes: 6 additions & 6 deletions src/librustc/infer/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ use traits::PredicateObligations;
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 }
}

Expand All @@ -33,9 +33,9 @@ impl<'a, 'gcx, 'tcx> Sub<'a, 'gcx, 'tcx> {
}
}

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
Expand Down

0 comments on commit 5e39032

Please sign in to comment.