pub fn struct_tail(self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
        loop {
            match ty.sty {
                ty::TyAdt(def, substs) => {
                    if !def.is_struct() {
                        break;
                    }
                    match def.non_enum_variant().fields.last() {
                        Some(f) => ty = f.ty(self, substs),
                        None => break,
                    }
                }

                ty::TyTuple(tys) => {
                    if let Some((&last_ty, _)) = tys.split_last() {
                        ty = last_ty;
                    } else {
                        break;
                    }
                }

                _ => {
                    break;
                }
            }
        }
        ty
    }
/// Returns the deeply last field of nested structures, or the same type,
/// if not a structure at all. Corresponds to the only possible unsized
/// field, and its type can be used to determine unsizing strategy.
Returns the deeply last field of nested structures, or the same type,
if not a structure at all. Corresponds to the only possible unsized
field, and its type can be used to determine unsizing strategy.
Returns the deeply last field of nested structures or the same type if not a structure at all . Corresponds to the only possible unsized field and its type can be used to determine unsizing strategy .
pub fn struct_tail(self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
        loop {
            match ty.sty {
                ty::TyAdt(def, substs) => {
                    if !def.is_struct() {
                        break;
                    }
                    match def.non_enum_variant().fields.last() {
                        Some(f) => ty = f.ty(self, substs),
                        None => break,
                    }
                }
                ty::TyTuple(tys) => {
                    if let Some((&last_ty, _)) = tys.split_last() {
                        ty = last_ty;
                    } else {
                        break;
                    }
                }
                _ => {
                    break;
                }
            }
        }
        ty
    }
pub fn struct_tail ( self , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > { loop { match ty . sty { ty :: TyAdt ( def , substs ) => { if ! def . is_struct ( ) { break ; } match def . non_enum_variant ( ) . fields . last ( ) { Some ( f ) => ty = f . ty ( self , substs ) , None => break , } } ty :: TyTuple ( tys ) => { if let Some ( ( & last_ty , _ ) ) = tys . split_last ( ) { ty = last_ty ; } else { break ; } } _ => { break ; } } } ty }
Returns the deeply last field of nested structures, or the same type,
if not a structure at all.
Returns the deeply last field of nested structures or the same type if not a structure at all .
self
ty
Ty<'tcx>