mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
+12
-12
@@ -211,12 +211,12 @@ fn CallFAndGIncomplete() {
|
||||
// CHECK:STDOUT: %ReturnDUsed.type: type = fn_type @ReturnDUsed [concrete]
|
||||
// CHECK:STDOUT: %ReturnDUsed: %ReturnDUsed.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
|
||||
// CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
|
||||
// CHECK:STDOUT: %facet_value: %type_where = facet_value %D, () [concrete]
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.707: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.34d: %AggregateT.as_type.as.Destroy.impl.Op.type.707 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.type.707: type = fn_type @DestroyT.as_type.as.Destroy.impl.Op, @DestroyT.as_type.as.Destroy.impl(%facet_value) [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.34d: %DestroyT.as_type.as.Destroy.impl.Op.type.707 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.19c: type = ptr_type %D [concrete]
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %AggregateT.as_type.as.Destroy.impl.Op.34d, @AggregateT.as_type.as.Destroy.impl.Op(%facet_value) [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %DestroyT.as_type.as.Destroy.impl.Op.34d, @DestroyT.as_type.as.Destroy.impl.Op(%facet_value) [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
@@ -279,18 +279,18 @@ fn CallFAndGIncomplete() {
|
||||
// CHECK:STDOUT: %.loc34_15.2: ref %D = temporary %.loc34_15.1, %ReturnDUsed.call
|
||||
// CHECK:STDOUT: %facet_value.loc34: %type_where = facet_value constants.%D, () [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %.loc34_15.3: %type_where = converted constants.%D, %facet_value.loc34 [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc34: <bound method> = bound_method %.loc34_15.2, constants.%AggregateT.as_type.as.Destroy.impl.Op.34d
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.1: <specific function> = specific_function constants.%AggregateT.as_type.as.Destroy.impl.Op.34d, @AggregateT.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%AggregateT.as_type.as.Destroy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc34: <bound method> = bound_method %.loc34_15.2, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.1
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.bound.loc34: <bound method> = bound_method %.loc34_15.2, constants.%DestroyT.as_type.as.Destroy.impl.Op.34d
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.specific_fn.1: <specific function> = specific_function constants.%DestroyT.as_type.as.Destroy.impl.Op.34d, @DestroyT.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.as_type.as.Destroy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc34: <bound method> = bound_method %.loc34_15.2, %DestroyT.as_type.as.Destroy.impl.Op.specific_fn.1
|
||||
// CHECK:STDOUT: %addr.loc34: %ptr.19c = addr_of %.loc34_15.2
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc34: init %empty_tuple.type = call %bound_method.loc34(%addr.loc34)
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.call.loc34: init %empty_tuple.type = call %bound_method.loc34(%addr.loc34)
|
||||
// CHECK:STDOUT: %facet_value.loc33: %type_where = facet_value constants.%D, () [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %.loc33_17.3: %type_where = converted constants.%D, %facet_value.loc33 [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc33: <bound method> = bound_method %.loc33_17.2, constants.%AggregateT.as_type.as.Destroy.impl.Op.34d
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.2: <specific function> = specific_function constants.%AggregateT.as_type.as.Destroy.impl.Op.34d, @AggregateT.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%AggregateT.as_type.as.Destroy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc33: <bound method> = bound_method %.loc33_17.2, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.2
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.bound.loc33: <bound method> = bound_method %.loc33_17.2, constants.%DestroyT.as_type.as.Destroy.impl.Op.34d
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.specific_fn.2: <specific function> = specific_function constants.%DestroyT.as_type.as.Destroy.impl.Op.34d, @DestroyT.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.as_type.as.Destroy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc33: <bound method> = bound_method %.loc33_17.2, %DestroyT.as_type.as.Destroy.impl.Op.specific_fn.2
|
||||
// CHECK:STDOUT: %addr.loc33: %ptr.19c = addr_of %.loc33_17.2
|
||||
// CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc33: init %empty_tuple.type = call %bound_method.loc33(%addr.loc33)
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.call.loc33: init %empty_tuple.type = call %bound_method.loc33(%addr.loc33)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user