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
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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:
-
The self type must be nominal (this is already checked during coherence),
-
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, -
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> { ... }
).