pub fn struct_lockstep_tails(self,
                                 source: Ty<'tcx>,
                                 target: Ty<'tcx>)
                                 -> (Ty<'tcx>, Ty<'tcx>) {
        let (mut a, mut b) = (source, target);
        loop {
            match (&a.sty, &b.sty) {
                (&TyAdt(a_def, a_substs), &TyAdt(b_def, b_substs))
                        if a_def == b_def && a_def.is_struct() => {
                    if let Some(f) = a_def.non_enum_variant().fields.last() {
                        a = f.ty(self, a_substs);
                        b = f.ty(self, b_substs);
                    } else {
                        break;
                    }
                },
                (&TyTuple(a_tys), &TyTuple(b_tys))
                        if a_tys.len() == b_tys.len() => {
                    if let Some(a_last) = a_tys.last() {
                        a = a_last;
                        b = b_tys.last().unwrap();
                    } else {
                        break;
                    }
                },
                _ => break,
            }
        }
        (a, b)
    }
/// Same as applying struct_tail on `source` and `target`, but only
/// keeps going as long as the two types are instances of the same
/// structure definitions.
/// For `(Foo<Foo<T>>, Foo<Trait>)`, the result will be `(Foo<T>, Trait)`,
/// whereas struct_tail produces `T`, and `Trait`, respectively.
Same as applying struct_tail on `source` and `target`, but only
keeps going as long as the two types are instances of the same
structure definitions.
Same as applying struct_tail on ` source ` and ` target ` but only keeps going as long as the two types are instances of the same structure definitions .
pub fn struct_lockstep_tails(self,
                                 source: Ty<'tcx>,
                                 target: Ty<'tcx>)
                                 -> (Ty<'tcx>, Ty<'tcx>) {
        let (mut a, mut b) = (source, target);
        loop {
            match (&a.sty, &b.sty) {
                (&TyAdt(a_def, a_substs), &TyAdt(b_def, b_substs))
                        if a_def == b_def && a_def.is_struct() => {
                    if let Some(f) = a_def.non_enum_variant().fields.last() {
                        a = f.ty(self, a_substs);
                        b = f.ty(self, b_substs);
                    } else {
                        break;
                    }
                },
                (&TyTuple(a_tys), &TyTuple(b_tys))
                        if a_tys.len() == b_tys.len() => {
                    if let Some(a_last) = a_tys.last() {
                        a = a_last;
                        b = b_tys.last().unwrap();
                    } else {
                        break;
                    }
                },
                _ => break,
            }
        }
        (a, b)
    }
pub fn struct_lockstep_tails ( self , source : Ty < ' tcx > , target : Ty < ' tcx > ) -> ( Ty < ' tcx > , Ty < ' tcx > ) { let ( mut a , mut b ) = ( source , target ) ; loop { match ( & a . sty , & b . sty ) { ( & TyAdt ( a_def , a_substs ) , & TyAdt ( b_def , b_substs ) ) if a_def == b_def && a_def . is_struct ( ) => { if let Some ( f ) = a_def . non_enum_variant ( ) . fields . last ( ) { a = f . ty ( self , a_substs ) ; b = f . ty ( self , b_substs ) ; } else { break ; } } , ( & TyTuple ( a_tys ) , & TyTuple ( b_tys ) ) if a_tys . len ( ) == b_tys . len ( ) => { if let Some ( a_last ) = a_tys . last ( ) { a = a_last ; b = b_tys . last ( ) . unwrap ( ) ; } else { break ; } } , _ => break , } } ( a , b ) }
Same as applying struct_tail on `source` and `target`, but only
keeps going as long as the two types are instances of the same
structure definitions.
Same as applying struct_tail on ` source ` and ` target ` but only keeps going as long as the two types are instances of the same structure definitions .
self
source
Ty<'tcx>
target
Ty<'tcx>