/// Return the VariantDef corresponding to an inlined variant node
Return the VariantDef corresponding to an inlined variant node
Return the VariantDef corresponding to an inlined variant node
pub fn inlined_variant_def<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                     inlined_vid: ast::NodeId)
                                     -> ty::VariantDef<'tcx>
{
    let ctor_ty = ccx.tcx().node_id_to_type(inlined_vid);
    debug!("inlined_variant_def: ctor_ty={:?} inlined_vid={:?}", ctor_ty,
           inlined_vid);
    let adt_def = match ctor_ty.sty {
        ty::TyBareFn(_, &ty::BareFnTy { sig: ty::Binder(ty::FnSig {
            output: ty::FnConverging(ty), ..
        }), ..}) => ty,
        _ => ctor_ty
    }.ty_adt_def().unwrap();
    adt_def.variants.iter().find(|v| {
        DefId::local(inlined_vid) == v.did ||
            ccx.external().borrow().get(&v.did) == Some(&Some(inlined_vid))
    }).unwrap_or_else(|| {
        ccx.sess().bug(&format!("no variant for {:?}::{}", adt_def, inlined_vid))
    })
}
pub fn inlined_variant_def < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > , inlined_vid : ast :: NodeId ) -> ty :: VariantDef < ' tcx > { let ctor_ty = ccx . tcx ( ) . node_id_to_type ( inlined_vid ) ; debug ! ( " " ctor_ty inlined_vid ) ; let adt_def = match ctor_ty . sty { ty :: TyBareFn ( _ , & ty :: BareFnTy { sig : ty :: Binder ( ty :: FnSig { output : ty :: FnConverging ( ty ) , .. } ) , .. } ) => ty , _ => ctor_ty } . ty_adt_def ( ) . unwrap ( ) ; adt_def . variants . iter ( ) . find ( | v | { DefId :: local ( inlined_vid ) == v . did || ccx . external ( ) . borrow ( ) . get ( & v . did ) == Some ( & Some ( inlined_vid ) ) } ) . unwrap_or_else ( | | { ccx . sess ( ) . bug ( & format ! ( " " adt_def inlined_vid ) ) } ) }
Return the VariantDef corresponding to an inlined variant node
Return the VariantDef corresponding to an inlined variant node
ccx
&CrateContext<'a, 'tcx>
inlined_vid
ast::NodeId