1
Fork 0

Rollup merge of #139349 - meithecatte:destructor-constness, r=compiler-errors

adt_destructor: sanity-check returned item

Fixes #139278
This commit is contained in:
Matthias Krüger 2025-04-04 08:02:09 +02:00 committed by GitHub
commit 0a9eae161b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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")