pub fn check_drop_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                 drop_impl_did: DefId)
                                 -> Result<(), ErrorReported> {
    let dtor_self_type = tcx.type_of(drop_impl_did);
    let dtor_predicates = tcx.predicates_of(drop_impl_did);
    match dtor_self_type.sty {
        ty::Adt(adt_def, self_to_impl_substs) => {
            ensure_drop_params_and_item_params_correspond(tcx,
                                                          drop_impl_did,
                                                          dtor_self_type,
                                                          adt_def.did)?;

            ensure_drop_predicates_are_implied_by_item_defn(tcx,
                                                            drop_impl_did,
                                                            &dtor_predicates,
                                                            adt_def.did,
                                                            self_to_impl_substs)
        }
        _ => {
            // Destructors only work on nominal types.  This was
            // already checked by coherence, but compilation may
            // not have been terminated.
            let span = tcx.def_span(drop_impl_did);
            tcx.sess.delay_span_bug(span,
                            &format!("should have been rejected by coherence check: {}",
                            dtor_self_type));
            Err(ErrorReported)
        }
    }
}
/// check_drop_impl confirms that the Drop implementation identified by
/// `drop_impl_did` is not any more specialized than the type it is
/// attached to (Issue #8142).
///
/// This means:
///
/// 1. The self type must be nominal (this is already checked during
///    coherence),
///
/// 2. The generic region/type parameters of the impl's self-type must
///    all be parameters of the Drop impl itself (i.e. no
///    specialization like `impl Drop for Foo<i32>`), and,
///
/// 3. Any bounds on the generic parameters must be reflected in the
///    struct/enum definition for the nominal type itself (i.e.
///    cannot do `struct S<T>; impl<T:Clone> Drop for S<T> { ... }`).
///
check_drop_impl confirms that the Drop implementation identified by
`drop_impl_did` is not any more specialized than the type it is
attached to (Issue #8142).

This means.

1. The self type must be nominal (this is already checked during
coherence).

2. The generic region/type parameters of the impl's self-type must
all be parameters of the Drop impl itself , and.

3. Any bounds on the generic parameters must be reflected in the
struct/enum definition for the nominal type itself .
check_drop_impl confirms that the Drop implementation identified by ` drop_impl_did ` is not any more specialized than the type it is attached to ( Issue #8142 ) . This means . 1 . The self type must be nominal ( this is already checked during coherence ) . 2 . The generic region / type parameters of the impl ' s self - type must all be parameters of the Drop impl itself and . 3 . Any bounds on the generic parameters must be reflected in the struct / enum definition for the nominal type itself .
pub fn check_drop_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                 drop_impl_did: DefId)
                                 -> Result<(), ErrorReported> {
    let dtor_self_type = tcx.type_of(drop_impl_did);
    let dtor_predicates = tcx.predicates_of(drop_impl_did);
    match dtor_self_type.sty {
        ty::Adt(adt_def, self_to_impl_substs) => {
            ensure_drop_params_and_item_params_correspond(tcx,
                                                          drop_impl_did,
                                                          dtor_self_type,
                                                          adt_def.did)?;
            ensure_drop_predicates_are_implied_by_item_defn(tcx,
                                                            drop_impl_did,
                                                            &dtor_predicates,
                                                            adt_def.did,
                                                            self_to_impl_substs)
        }
        _ => {
            // Destructors only work on nominal types.  This was
            // already checked by coherence, but compilation may
            // not have been terminated.
            let span = tcx.def_span(drop_impl_did);
            tcx.sess.delay_span_bug(span,
                            &format!("should have been rejected by coherence check: {}",
                            dtor_self_type));
            Err(ErrorReported)
        }
    }
}
pub fn check_drop_impl < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , drop_impl_did : DefId ) -> Result < ( ) , ErrorReported > { let dtor_self_type = tcx . type_of ( drop_impl_did ) ; let dtor_predicates = tcx . predicates_of ( drop_impl_did ) ; match dtor_self_type . sty { ty :: Adt ( adt_def , self_to_impl_substs ) => { ensure_drop_params_and_item_params_correspond ( tcx , drop_impl_did , dtor_self_type , adt_def . did ) ? ; ensure_drop_predicates_are_implied_by_item_defn ( tcx , drop_impl_did , & dtor_predicates , adt_def . did , self_to_impl_substs ) } _ => { // Destructors only work on nominal types.  This was // already checked by coherence, but compilation may // not have been terminated. let span = tcx . def_span ( drop_impl_did ) ; tcx . sess . delay_span_bug ( span , & format ! ( " " dtor_self_type ) ) ; Err ( ErrorReported ) } } }
check_drop_impl confirms that the Drop implementation identified by
`drop_impl_did` is not any more specialized than the type it is
attached to (Issue #8142).
check_drop_impl confirms that the Drop implementation identified by ` drop_impl_did ` is not any more specialized than the type it is attached to ( Issue #8142 ) .
tcx
TyCtxt<'a, 'tcx, 'tcx>
drop_impl_did
DefId
tcx
TyCtxt<'a, 'tcx, 'tcx>
drop_impl_did
DefId