Trait rustc::middle::ty_relate::TypeRelationUnstable [-] [+] [src]

pub trait TypeRelation<'a, 'tcx>: Sized {
    fn tcx(&self) -> &'a ctxt<'tcx>;
    fn tag(&self) -> &'static str;
    fn a_is_expected(&self) -> bool;
    fn relate_with_variance<T: Relate<'a, 'tcx>>(&mut self, variance: Variance, a: &T, b: &T) -> RelateResult<'tcx, T>;
    fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>>;
    fn regions(&mut self, a: Region, b: Region) -> RelateResult<'tcx, Region>;
    fn binders<T>(&mut self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tcx, Binder<T>> where T: Relate<'a, 'tcx>;

    fn relate<T: Relate<'a, 'tcx>>(&mut self, a: &T, b: &T) -> RelateResult<'tcx, T> { ... }
}

Required Methods

fn tcx(&self) -> &'a ctxt<'tcx>

fn tag(&self) -> &'static str

Returns a static string we can use for printouts.

fn a_is_expected(&self) -> bool

Returns true if the value a is the "expected" type in the relation. Just affects error messages.

fn relate_with_variance<T: Relate<'a, 'tcx>>(&mut self, variance: Variance, a: &T, b: &T) -> RelateResult<'tcx, T>

Switch variance for the purpose of relating a and b.

fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>>

fn regions(&mut self, a: Region, b: Region) -> RelateResult<'tcx, Region>

fn binders<T>(&mut self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tcx, Binder<T>> where T: Relate<'a, 'tcx>

Provided Methods

fn relate<T: Relate<'a, 'tcx>>(&mut self, a: &T, b: &T) -> RelateResult<'tcx, T>

Generic relation routine suitable for most anything.

Implementors