Function rustc_typeck::check::dropck::check_drop_impl [] [src]

pub fn check_drop_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                 drop_impl_did: DefId)
                                 -> Result<(), ErrorReported>
🔬 This is a nightly-only experimental API. (rustc_private)

check_drop_impl confirms that the Drop implementation identfied 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> { ... }).