Only look at trait impls in the current crate when looking for Drop impls

This commit is contained in:
Oli Scherer 2025-03-27 14:11:44 +00:00
parent 51184c70c8
commit ca32447c0c
3 changed files with 30 additions and 18 deletions

View file

@ -36,10 +36,8 @@ use crate::hir::def_id::{DefId, LocalDefId};
/// cannot do `struct S<T>; impl<T:Clone> Drop for S<T> { ... }`).
pub(crate) fn check_drop_impl(
tcx: TyCtxt<'_>,
drop_impl_did: DefId,
drop_impl_did: LocalDefId,
) -> Result<(), ErrorGuaranteed> {
let drop_impl_did = drop_impl_did.expect_local();
match tcx.impl_polarity(drop_impl_did) {
ty::ImplPolarity::Positive => {}
ty::ImplPolarity::Negative => {