1
Fork 0

adt_destructor: sanity-check returned item

Fixes #139278
This commit is contained in:
Maja Kądziołka 2025-04-04 05:17:45 +02:00
parent 00095b3da4
commit a14e8f687c
No known key found for this signature in database
3 changed files with 33 additions and 0 deletions

View file

@ -414,6 +414,11 @@ impl<'tcx> TyCtxt<'tcx> {
continue;
};
if self.def_kind(item_id) != DefKind::AssocFn {
self.dcx().span_delayed_bug(self.def_span(item_id), "drop is not a function");
continue;
}
if let Some(old_item_id) = dtor_candidate {
self.dcx()
.struct_span_err(self.def_span(item_id), "multiple drop impls found")