mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:44:41 +01:00
Add Destroy.SubobjectDestroy as a temporary replacement for Destroy.Op (#7773)
This change partially implements [PR #7362], which revises how objects are destroyed. It is a partial implementation for two reasons: 1. This change moves `Destroy.Op`'s current behaviour into `Destroy.SubobjectDestroy`, but it doesn't add support for objects with non-trivial destruction. 2. `Destroy.SubobjectDestroy` is a workaround for `require impls SubobjectDestroy`. We aren't able to use the latter until the dependents add their requirements' implementations to their own witness tables. [PR #7362]: https://github.com/carbon-language/carbon-lang/pulls/7362
This commit is contained in:
@@ -157,7 +157,9 @@ static auto AddCleanups(Context& context, ScopeStack::CleanupScopeDepth depth)
|
||||
// cleanup blocks, so we'll want to avoid this in the future.
|
||||
BuildUnaryOperator(context,
|
||||
context.insts().GetLocIdForDesugaring(destroy_id),
|
||||
{.interface_name = CoreIdentifier::Destroy}, destroy_id);
|
||||
{.interface_name = CoreIdentifier::Destroy,
|
||||
.op_name = CoreIdentifier::SelfDestruct},
|
||||
destroy_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user