pub fn calculate_dtor(
        self,
        adt_did: DefId,
        validate: &mut dyn FnMut(Self, DefId) -> Result<(), ErrorReported>
    ) -> Option<ty::Destructor> {
        let drop_trait = if let Some(def_id) = self.lang_items().drop_trait() {
            def_id
        } else {
            return None;
        };

        ty::query::queries::coherent_trait::ensure(self, drop_trait);

        let mut dtor_did = None;
        let ty = self.type_of(adt_did);
        self.for_each_relevant_impl(drop_trait, ty, |impl_did| {
            if let Some(item) = self.associated_items(impl_did).next() {
                if let Ok(()) = validate(self, impl_did) {
                    dtor_did = Some(item.def_id);
                }
            }
        });

        Some(ty::Destructor { did: dtor_did? })
    }
/// Calculate the destructor of a given type.
Calculate the destructor of a given type.
Calculate the destructor of a given type .
pub fn calculate_dtor(
        self,
        adt_did: DefId,
        validate: &mut dyn FnMut(Self, DefId) -> Result<(), ErrorReported>
    ) -> Option<ty::Destructor> {
        let drop_trait = if let Some(def_id) = self.lang_items().drop_trait() {
            def_id
        } else {
            return None;
        };
        ty::query::queries::coherent_trait::ensure(self, drop_trait);
        let mut dtor_did = None;
        let ty = self.type_of(adt_did);
        self.for_each_relevant_impl(drop_trait, ty, |impl_did| {
            if let Some(item) = self.associated_items(impl_did).next() {
                if let Ok(()) = validate(self, impl_did) {
                    dtor_did = Some(item.def_id);
                }
            }
        });
        Some(ty::Destructor { did: dtor_did? })
    }
pub fn calculate_dtor ( self , adt_did : DefId , validate : & mut dyn FnMut ( Self , DefId ) -> Result < ( ) , ErrorReported > ) -> Option < ty :: Destructor > { let drop_trait = if let Some ( def_id ) = self . lang_items ( ) . drop_trait ( ) { def_id } else { return None ; } ; ty :: query :: queries :: coherent_trait :: ensure ( self , drop_trait ) ; let mut dtor_did = None ; let ty = self . type_of ( adt_did ) ; self . for_each_relevant_impl ( drop_trait , ty , | impl_did | { if let Some ( item ) = self . associated_items ( impl_did ) . next ( ) { if let Ok ( ( ) ) = validate ( self , impl_did ) { dtor_did = Some ( item . def_id ) ; } } } ) ; Some ( ty :: Destructor { did : dtor_did ? } ) }
Calculate the destructor of a given type.
Calculate the destructor of a given type .
self
adt_did
DefId
validate
&mut dyn FnMut(Self, DefId) -> Result<(), ErrorReported>