Skip to content

Commit 7b4a1ab

Browse files
authored
Merge pull request swiftlang#78107 from ktoso/pick-mpokhylets-isolated-deinit-version
2 parents bdaf590 + b51213f commit 7b4a1ab

28 files changed

+119
-72
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,9 @@ namespace SpecialPointerAuthDiscriminators {
17041704
const uint16_t RelativeProtocolWitnessTable = 0xb830; // = 47152
17051705

17061706
const uint16_t TypeLayoutString = 0x8b65; // = 35685
1707+
1708+
/// Isolated deinit body function pointer
1709+
const uint16_t DeinitWorkFunction = 0x8438; // = 33848
17071710
}
17081711

17091712
/// The number of arguments that will be passed directly to a generic

include/swift/AST/DiagnosticsSIL.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,11 @@ NOTE(box_to_stack_cannot_promote_box_to_stack_due_to_escape_location, none,
790790

791791
WARNING(semantic_function_improper_nesting, none, "'@_semantics' function calls non-'@_semantics' function with nested '@_semantics' calls", ())
792792

793+
// SDK mismatch diagnostics
794+
ERROR(missing_deinit_on_executor_function, none,
795+
"Missing 'swift_task_deinitOnExecutor' function! "
796+
"This is likely due to an outdated/incompatible SDK.", ())
797+
793798
// Capture promotion diagnostics
794799
WARNING(capturepromotion_concurrentcapture_mutation, none,
795800
"'%0' mutated after capture by sendable closure", (StringRef))

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5963,6 +5963,9 @@ ERROR(isolated_deinit_no_isolation,none,
59635963
ERROR(isolated_deinit_on_value_type,none,
59645964
"only classes and actors can have isolated deinit",
59655965
())
5966+
ERROR(isolated_deinit_unavailable,none,
5967+
"isolated deinit is only available in %0 %1 or newer",
5968+
(StringRef, llvm::VersionTuple))
59665969
ERROR(isolated_deinit_experimental,none,
59675970
"'isolated' deinit requires frontend flag -enable-experimental-feature IsolatedDeinit "
59685971
"to enable the usage of this language feature", ())

include/swift/AST/FeatureAvailability.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ FEATURE(InitRawStructMetadata, (6, 0))
7676

7777
FEATURE(LayoutStringValueWitnesses, (6, 1))
7878
FEATURE(CreateTaskWithConsumedFunction, (6, 1))
79+
FEATURE(IsolatedDeinit, (6, 1))
7980

8081
FEATURE(TaskExecutor, FUTURE)
8182
FEATURE(Differentiation, FUTURE)

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ EXPERIMENTAL_FEATURE(SafeInterop, true)
410410
EXPERIMENTAL_FEATURE(AssumeResilientCxxTypes, true)
411411

412412
// Isolated deinit
413-
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(IsolatedDeinit, true)
413+
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(IsolatedDeinit, false)
414414

415415
// Enable values in generic signatures, e.g. <let N: Int>
416416
EXPERIMENTAL_FEATURE(ValueGenerics, true)

include/swift/Runtime/Config.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL
324324
#define __ptrauth_swift_type_layout_string \
325325
__ptrauth(ptrauth_key_process_independent_data, 1, \
326326
SpecialPointerAuthDiscriminators::TypeLayoutString)
327+
#define __ptrauth_swift_deinit_work_function \
328+
__ptrauth(ptrauth_key_function_pointer, 1, \
329+
SpecialPointerAuthDiscriminators::DeinitWorkFunction)
327330

328331
#if __has_attribute(ptrauth_struct)
329332
#define swift_ptrauth_struct(key, discriminator) \
@@ -364,6 +367,7 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL
364367
#define swift_ptrauth_sign_opaque_read_resume_function(__fn, __buffer) (__fn)
365368
#define swift_ptrauth_sign_opaque_modify_resume_function(__fn, __buffer) (__fn)
366369
#define __ptrauth_swift_type_layout_string
370+
#define __ptrauth_swift_deinit_work_function
367371
#define swift_ptrauth_struct(key, discriminator)
368372
#define swift_ptrauth_struct_derived(from)
369373
#endif
@@ -542,6 +546,17 @@ swift_auth_code(T value, unsigned extra) {
542546
#endif
543547
}
544548

549+
template <typename T>
550+
SWIFT_RUNTIME_ATTRIBUTE_ALWAYS_INLINE static inline T
551+
swift_auth_code_function(T value, unsigned extra) {
552+
#if SWIFT_PTRAUTH
553+
return (T)ptrauth_auth_function((void *)value,
554+
ptrauth_key_function_pointer, extra);
555+
#else
556+
return value;
557+
#endif
558+
}
559+
545560
/// Does this platform support backtrace-on-crash?
546561
#ifdef __APPLE__
547562
# include <TargetConditionals.h>

lib/SILGen/SILGenDestructor.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "SwitchEnumBuilder.h"
1818
#include "swift/AST/ConformanceLookup.h"
1919
#include "swift/AST/Decl.h"
20+
#include "swift/AST/DiagnosticsSIL.h"
2021
#include "swift/AST/GenericSignature.h"
2122
#include "swift/AST/SubstitutionMap.h"
2223
#include "swift/Basic/Assertions.h"
@@ -373,8 +374,10 @@ void SILGenFunction::emitIsolatingDestructor(DestructorDecl *dd) {
373374

374375
// Get deinitOnExecutor
375376
FuncDecl *swiftDeinitOnExecutorDecl = SGM.getDeinitOnExecutor();
376-
assert(swiftDeinitOnExecutorDecl &&
377-
"Failed to find swift_task_deinitOnExecutor function decl");
377+
if (!swiftDeinitOnExecutorDecl) {
378+
dd->diagnose(diag::missing_deinit_on_executor_function);
379+
return;
380+
}
378381
SILFunction *swiftDeinitOnExecutorSILFunc = SGM.getFunction(
379382
SILDeclRef(swiftDeinitOnExecutorDecl, SILDeclRef::Kind::Func),
380383
NotForDefinition);

lib/Sema/TypeCheckAttr.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
127127
return;
128128
}
129129
}
130+
131+
TypeChecker::checkAvailability(
132+
attr->getRange(), C.getIsolatedDeinitAvailability(),
133+
D->getDeclContext(),
134+
[&](StringRef platformName, llvm::VersionTuple version) {
135+
return diagnoseAndRemoveAttr(
136+
attr, diag::isolated_deinit_unavailable, platformName, version);
137+
});
130138
}
131139
}
132140

stdlib/public/Concurrency/Actor.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "swift/Runtime/Concurrency.h"
1919
#include <atomic>
2020
#include <new>
21+
#include <ptrauth.h>
2122

2223
#include "../CompatibilityOverride/CompatibilityOverride.h"
2324
#include "swift/ABI/Actor.h"
@@ -2322,7 +2323,7 @@ namespace {
23222323
class IsolatedDeinitJob : public Job {
23232324
private:
23242325
void *Object;
2325-
DeinitWorkFunction *Work;
2326+
DeinitWorkFunction *__ptrauth_swift_deinit_work_function Work;
23262327

23272328
public:
23282329
IsolatedDeinitJob(JobPriority priority, void *object,
@@ -2351,6 +2352,9 @@ static void swift_task_deinitOnExecutorImpl(void *object,
23512352
DeinitWorkFunction *work,
23522353
SerialExecutorRef newExecutor,
23532354
size_t rawFlags) {
2355+
// Sign the function pointer
2356+
work = swift_auth_code_function(
2357+
work, SpecialPointerAuthDiscriminators::DeinitWorkFunction);
23542358
// If the current executor is compatible with running the new executor,
23552359
// we can just immediately continue running with the resume function
23562360
// we were passed in.

stdlib/public/Concurrency/Executor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ internal final class DispatchQueueShim: @unchecked Sendable, SerialExecutor {
541541
#endif // SWIFT_CONCURRENCY_USES_DISPATCH
542542

543543

544-
@available(SwiftStdlib 5.6, *) // TODO: Clarify version
544+
@available(SwiftStdlib 6.1, *)
545545
@_silgen_name("swift_task_deinitOnExecutor")
546546
@usableFromInline
547547
internal func _deinitOnExecutor(_ object: __owned AnyObject,

test/Concurrency/Runtime/actor_deinit_escaping_self.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// RUN: %target-run-simple-swift( -enable-experimental-feature IsolatedDeinit -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library)
1+
// RUN: %target-run-simple-swift( -enable-experimental-feature IsolatedDeinit -target %target-future-triple %import-libdispatch -parse-as-library)
22

33
// REQUIRES: executable_test
44
// REQUIRES: libdispatch
55
// REQUIRES: concurrency
66
// REQUIRES: concurrency_runtime
7-
// REQUIRES: swift_feature_IsolatedDeinit
87
// UNSUPPORTED: back_deployment_runtime
8+
// REQUIRES: swift_feature_IsolatedDeinit
99

1010
import _Concurrency
1111
import Dispatch

test/Concurrency/Runtime/actor_recursive_deinit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// RUN: %target-run-simple-swift(-enable-experimental-feature IsolatedDeinit -target %target-swift-5.1-abi-triple -parse-stdlib -parse-as-library) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature IsolatedDeinit -target %target-future-triple -parse-stdlib -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency
55

66
// REQUIRES: concurrency_runtime
7-
// REQUIRES: swift_feature_IsolatedDeinit
87
// UNSUPPORTED: back_deployment_runtime
8+
// REQUIRES: swift_feature_IsolatedDeinit
99

1010
// Compiler crashes because builtin "ifdef_SWIFT_STDLIB_PRINT_DISABLED"() gets lowered as "i32 0",
1111
// which triggers assertion in LLVM, which expects it to be i1

test/Concurrency/Runtime/async_task_locals_isolated_deinit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -enable-experimental-feature IsolatedDeinit -plugin-path %swift-plugin-dir -enable-experimental-feature IsolatedDeinit -target %target-swift-5.1-abi-triple -parse-stdlib %import-libdispatch %s -o %t/a.out
2+
// RUN: %target-build-swift -enable-experimental-feature IsolatedDeinit -plugin-path %swift-plugin-dir -target %target-future-triple -parse-stdlib %import-libdispatch %s -o %t/a.out
33
// RUN: %target-codesign %t/a.out
44
// RUN: %env-SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE=swift6 %target-run %t/a.out
55

test/Concurrency/Runtime/isolated_deinit_main_sync.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-enable-experimental-feature IsolatedDeinit -target %target-swift-5.1-abi-triple) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature IsolatedDeinit -target %target-future-triple) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Concurrency/deinit_isolation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -parse-as-library -enable-experimental-feature IsolatedDeinit -emit-silgen -verify %s
2-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -parse-as-library -enable-experimental-feature IsolatedDeinit -emit-silgen -DSILGEN %s | %FileCheck %s
3-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -parse-as-library -enable-experimental-feature IsolatedDeinit -emit-silgen -DSILGEN %s | %FileCheck -check-prefix=CHECK-SYMB %s
1+
// RUN: %target-swift-frontend -target %target-future-triple -parse-as-library -enable-experimental-feature IsolatedDeinit -emit-silgen -verify %s
2+
// RUN: %target-swift-frontend -target %target-future-triple -parse-as-library -enable-experimental-feature IsolatedDeinit -emit-silgen -DSILGEN %s | %FileCheck %s
3+
// RUN: %target-swift-frontend -target %target-future-triple -parse-as-library -enable-experimental-feature IsolatedDeinit -emit-silgen -DSILGEN %s | %FileCheck -check-prefix=CHECK-SYMB %s
44

55
// REQUIRES: concurrency
66
// REQUIRES: swift_feature_IsolatedDeinit

test/Concurrency/deinit_isolation_import/test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: cp -R $INPUT_DIR/Alpha.framework %t/Frameworks/
44
// RUN: %empty-directory(%t/Frameworks/Alpha.framework/Modules/Alpha.swiftmodule)
55
// RUN: %empty-directory(%t/Frameworks/Alpha.framework/Headers/)
6-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -parse-as-library -module-name Alpha \
6+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -parse-as-library -disable-availability-checking -module-name Alpha \
77
// RUN: -emit-module -o %t/Frameworks/Alpha.framework/Modules/Alpha.swiftmodule/%module-target-triple.swiftmodule \
88
// RUN: -enable-objc-interop -disable-objc-attr-requires-foundation-module \
99
// RUN: -emit-objc-header -emit-objc-header-path %t/Frameworks/Alpha.framework/Headers/Alpha-Swift.h $INPUT_DIR/Alpha.swift

test/Concurrency/deinit_isolation_in_value_types.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -enable-experimental-feature IsolatedDeinit -parse-as-library -emit-silgen -verify %s
1+
// RUN: %target-swift-frontend -target %target-future-triple -enable-experimental-feature IsolatedDeinit -parse-as-library -emit-silgen -verify %s
22

33
// REQUIRES: swift_feature_IsolatedDeinit
44

test/Concurrency/deinit_isolation_objc.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -target %target-swift-5.1-abi-triple -parse-as-library -emit-silgen -verify %s
2-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -target %target-swift-5.1-abi-triple -parse-as-library -emit-silgen -DSILGEN %s | %FileCheck %s
3-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -target %target-swift-5.1-abi-triple -parse-as-library -emit-silgen -DSILGEN %s | %FileCheck -check-prefix=CHECK-SYMB %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -target %target-future-triple -parse-as-library -emit-silgen -verify %s
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -target %target-future-triple -parse-as-library -emit-silgen -DSILGEN %s | %FileCheck %s
3+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-implicit-string-processing-module-import -target %target-future-triple -parse-as-library -emit-silgen -DSILGEN %s | %FileCheck -check-prefix=CHECK-SYMB %s
44

55
// REQUIRES: concurrency
66
// REQUIRES: objc_interop

test/Concurrency/deinit_isolation_tbd.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -emit-ir %s | %FileCheck %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature IsolatedDeinit -disable-availability-checking -emit-ir %s | %FileCheck %s
22

33
// REQUIRES: swift_feature_IsolatedDeinit
44

test/Concurrency/flow_isolation.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ actor Demons {
128128
self.ns = x
129129
}
130130

131-
nonisolated deinit {
131+
deinit {
132132
let _ = self.ns // expected-warning {{cannot access property 'ns' with a non-sendable type 'NonSendableType' from nonisolated deinit; this is an error in the Swift 6 language mode}}
133133
}
134134
}
@@ -159,7 +159,7 @@ actor ExampleFromProposal {
159159
}
160160

161161

162-
nonisolated deinit {
162+
deinit {
163163
_ = self.immutableSendable // ok
164164
_ = self.mutableSendable // ok
165165
_ = self.nonSendable // expected-warning {{cannot access property 'nonSendable' with a non-sendable type 'NonSendableType' from nonisolated deinit; this is an error in the Swift 6 language mode}}
@@ -199,7 +199,7 @@ class CheckGAIT1 {
199199
silly += 2 // expected-warning {{cannot access property 'silly' here in nonisolated initializer; this is an error in the Swift 6 language mode}}
200200
}
201201

202-
nonisolated deinit {
202+
deinit {
203203
_ = ns // expected-warning {{cannot access property 'ns' with a non-sendable type 'NonSendableType' from nonisolated deinit; this is an error in the Swift 6 language mode}}
204204
f() // expected-note {{after calling instance method 'f()', only nonisolated properties of 'self' can be accessed from a deinit}}
205205
_ = silly // expected-warning {{cannot access property 'silly' here in deinitializer; this is an error in the Swift 6 language mode}}
@@ -623,7 +623,7 @@ actor Ahmad {
623623
prop += 1 // expected-warning {{cannot access property 'prop' here in nonisolated initializer; this is an error in the Swift 6 language mode}}
624624
}
625625

626-
nonisolated deinit {
626+
deinit {
627627
// expected-warning@+2 {{actor-isolated property 'computedProp' can not be referenced from a nonisolated context; this is an error in the Swift 6 language mode}}
628628
// expected-note@+1 {{after accessing property 'computedProp', only nonisolated properties of 'self' can be accessed from a deinit}}
629629
let x = computedProp
@@ -679,7 +679,7 @@ actor NonIsolatedDeinitExceptionForSwift5 {
679679
}
680680
}
681681

682-
@available(SwiftStdlib 5.5, *)
682+
@available(SwiftStdlib 6.1, *)
683683
actor IsolatedDeinitExceptionForSwift5 {
684684
var x: Int = 0
685685

test/Concurrency/voucher_propagation.swift

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ actor Counter {
7676
func get() -> Int { n }
7777
}
7878

79+
@available(SwiftStdlib 6.1, *)
7980
actor ActorWithSelfIsolatedDeinit {
8081
let expectedVoucher: voucher_t?
8182
let group: DispatchGroup
@@ -102,6 +103,7 @@ actor ActorWithSelfIsolatedDeinit {
102103
}
103104
}
104105

106+
@available(SwiftStdlib 6.1, *)
105107
actor ActorWithDeinitIsolatedOnAnother {
106108
let expectedVoucher: voucher_t?
107109
let group: DispatchGroup
@@ -121,6 +123,7 @@ actor ActorWithDeinitIsolatedOnAnother {
121123
}
122124
}
123125

126+
@available(SwiftStdlib 6.1, *)
124127
class ClassWithIsolatedDeinit {
125128
let expectedVoucher: voucher_t?
126129
let group: DispatchGroup
@@ -427,47 +430,49 @@ if #available(SwiftStdlib 5.1, *) {
427430
group.wait()
428431
}
429432
}
430-
431-
tests.test("voucher propagation in isolated deinit [fast path]") {
432-
withVouchers { v1, v2, v3 in
433-
let group = DispatchGroup()
434-
group.enter()
435-
group.enter()
436-
group.enter()
437-
Task {
438-
await AnotherActor.shared.performTesting {
439-
adopt(voucher: v1)
440-
_ = ClassWithIsolatedDeinit(expectedVoucher: v1, group: group)
441-
}
442-
await AnotherActor.shared.performTesting {
443-
adopt(voucher: v2)
444-
_ = ActorWithSelfIsolatedDeinit(expectedVoucher: v2, group: group)
445-
}
446-
await AnotherActor.shared.performTesting {
447-
adopt(voucher: v3)
448-
_ = ActorWithDeinitIsolatedOnAnother(expectedVoucher: v3, group: group)
433+
434+
if #available(SwiftStdlib 6.1, *) {
435+
tests.test("voucher propagation in isolated deinit [fast path]") {
436+
withVouchers { v1, v2, v3 in
437+
let group = DispatchGroup()
438+
group.enter()
439+
group.enter()
440+
group.enter()
441+
Task {
442+
await AnotherActor.shared.performTesting {
443+
adopt(voucher: v1)
444+
_ = ClassWithIsolatedDeinit(expectedVoucher: v1, group: group)
445+
}
446+
await AnotherActor.shared.performTesting {
447+
adopt(voucher: v2)
448+
_ = ActorWithSelfIsolatedDeinit(expectedVoucher: v2, group: group)
449+
}
450+
await AnotherActor.shared.performTesting {
451+
adopt(voucher: v3)
452+
_ = ActorWithDeinitIsolatedOnAnother(expectedVoucher: v3, group: group)
453+
}
449454
}
455+
group.wait()
450456
}
451-
group.wait()
452457
}
453-
}
454-
455-
tests.test("voucher propagation in isolated deinit [slow path]") {
456-
withVouchers { v1, v2, v3 in
457-
let group = DispatchGroup()
458-
group.enter()
459-
group.enter()
460-
Task {
461-
do {
462-
adopt(voucher: v1)
463-
_ = ActorWithDeinitIsolatedOnAnother(expectedVoucher: v1, group: group)
464-
}
465-
do {
466-
adopt(voucher: v2)
467-
_ = ClassWithIsolatedDeinit(expectedVoucher: v2, group: group)
458+
459+
tests.test("voucher propagation in isolated deinit [slow path]") {
460+
withVouchers { v1, v2, v3 in
461+
let group = DispatchGroup()
462+
group.enter()
463+
group.enter()
464+
Task {
465+
do {
466+
adopt(voucher: v1)
467+
_ = ActorWithDeinitIsolatedOnAnother(expectedVoucher: v1, group: group)
468+
}
469+
do {
470+
adopt(voucher: v2)
471+
_ = ClassWithIsolatedDeinit(expectedVoucher: v2, group: group)
472+
}
468473
}
474+
group.wait()
469475
}
470-
group.wait()
471476
}
472477
}
473478
}

0 commit comments

Comments
 (0)