Rename/restructure Destroy logic to better reflect #6124 (#6144)

This also does a little restructuring in the same direction, following
#6124.

Leads want `Destroy` to work similarly now for all types. As a
consequence, there doesn't seem to be as much benefit to splitting off
aggregate destruction. In this PR, the `type.destroy` function can now
be expected to destroy anything that's destructible; that means it'll be
usable for the `final fn` once that support is available.

Similarly, this gets rid of the impls other than the single blanket
impl, now using `type.can_destroy`. Since they all need to use the same
function, there's no benefit to splitting approaches. Also, now it can
just be a `final impl` since there should be no need for people to
create specializations -- if this blanket impl applies, it means the
`final fn` is the same.

This also slips in `partial` support since there's no reason to have it
diverge anymore. Also `abstract`, which I'm not sure is broadly testable
since most cases it'd come up, the `abstract` keyword is explicitly
detected/rejected.

Note though that this doesn't make any really big changes. It's just
realigning on the leads decision. I'm going this way to try to reduce
name-related churn for other changes.
This commit is contained in:
Jon Ross-Perkins
2025-09-30 20:43:36 +00:00
committed by GitHub
parent 0166d8837c
commit 4a6376cf59
160 changed files with 4005 additions and 3863 deletions
+2 -2
View File
@@ -331,11 +331,11 @@ class Stringifier {
some_where = true;
}
if (facet_type_info.builtin_constraint_mask.HasAnyOf(
SemIR::BuiltinConstraintMask::TypeCanAggregateDestroy)) {
SemIR::BuiltinConstraintMask::TypeCanDestroy)) {
if (some_where) {
step_stack_->PushString(" and");
}
step_stack_->PushString(" .Self impls Core.CanAggregateDestroy");
step_stack_->PushString(" .Self impls Core.CanDestroy");
some_where = true;
}
for (auto rewrite : llvm::reverse(facet_type_info.rewrite_constraints)) {