@@ -60,6 +60,9 @@ class ActorIsolation {
6060 // / meaning that it can be used from any actor but is also unable to
6161 // / refer to the isolated state of any given actor.
6262 Nonisolated,
63+ // / The declaration is explicitly specified to be not isolated and with the
64+ // / "unsafe" annotation, which means that we do not enforce isolation.
65+ NonisolatedUnsafe,
6366 // / The declaration is isolated to a global actor. It can refer to other
6467 // / entities with the same global actor.
6568 GlobalActor,
@@ -97,8 +100,8 @@ class ActorIsolation {
97100 return ActorIsolation (Unspecified, nullptr );
98101 }
99102
100- static ActorIsolation forNonisolated () {
101- return ActorIsolation (Nonisolated, nullptr );
103+ static ActorIsolation forNonisolated (bool unsafe ) {
104+ return ActorIsolation (unsafe ? NonisolatedUnsafe : Nonisolated, nullptr );
102105 }
103106
104107 static ActorIsolation forActorInstanceSelf (NominalTypeDecl *actor) {
@@ -124,8 +127,10 @@ class ActorIsolation {
124127 operator Kind () const { return getKind (); }
125128
126129 bool isUnspecified () const { return kind == Unspecified; }
127-
128- bool isNonisolated () const { return kind == Nonisolated; }
130+
131+ bool isNonisolated () const {
132+ return (kind == Nonisolated) || (kind == NonisolatedUnsafe);
133+ }
129134
130135 // / Retrieve the parameter to which actor-instance isolation applies.
131136 // /
@@ -144,6 +149,7 @@ class ActorIsolation {
144149
145150 case Unspecified:
146151 case Nonisolated:
152+ case NonisolatedUnsafe:
147153 return false ;
148154 }
149155 }
@@ -192,6 +198,7 @@ class ActorIsolation {
192198
193199 switch (lhs.getKind ()) {
194200 case Nonisolated:
201+ case NonisolatedUnsafe:
195202 case Unspecified:
196203 return true ;
197204
0 commit comments