@@ -729,11 +729,18 @@ SILFunction *SILGenModule::getFunction(SILDeclRef constant,
729
729
return IGM.getFunction (constant, NotForDefinition);
730
730
});
731
731
732
- // If we have global actor isolation for our constant, put the isolation onto
733
- // the function.
734
- if (auto isolation =
735
- getActorIsolationOfContext (constant.getInnermostDeclContext ())) {
736
- F->setActorIsolation (isolation);
732
+ if (constant.kind == SILDeclRef::Kind::Deallocator) {
733
+ // Deallocating destructor is always nonisolated.
734
+ // Isolation of the deinit applies only to isolated deallocator and
735
+ // destroyer.
736
+ F->setActorIsolation (ActorIsolation::forNonisolated (false ));
737
+ } else {
738
+ // If we have global actor isolation for our constant, put the isolation
739
+ // onto the function.
740
+ if (auto isolation =
741
+ getActorIsolationOfContext (constant.getInnermostDeclContext ())) {
742
+ F->setActorIsolation (isolation);
743
+ }
737
744
}
738
745
739
746
assert (F && " SILFunction should have been defined" );
@@ -1231,11 +1238,18 @@ void SILGenModule::preEmitFunction(SILDeclRef constant, SILFunction *F,
1231
1238
F->setGenericEnvironment (genericEnv, capturedEnvs, forwardingSubs);
1232
1239
}
1233
1240
1234
- // If we have global actor isolation for our constant, put the isolation onto
1235
- // the function.
1236
- if (auto isolation =
1237
- getActorIsolationOfContext (constant.getInnermostDeclContext ())) {
1238
- F->setActorIsolation (isolation);
1241
+ if (constant.kind == SILDeclRef::Kind::Deallocator) {
1242
+ // Deallocating destructor is always nonisolated.
1243
+ // Isolation of the deinit applies only to isolated deallocator and
1244
+ // destroyer.
1245
+ F->setActorIsolation (ActorIsolation::forNonisolated (false ));
1246
+ } else {
1247
+ // If we have global actor isolation for our constant, put the isolation
1248
+ // onto the function.
1249
+ if (auto isolation =
1250
+ getActorIsolationOfContext (constant.getInnermostDeclContext ())) {
1251
+ F->setActorIsolation (isolation);
1252
+ }
1239
1253
}
1240
1254
1241
1255
// Create a debug scope for the function using astNode as source location.
0 commit comments