Skip to content

Commit ab4b5ca

Browse files
Merge pull request #4818 from swiftwasm/release/5.7
[pull] swiftwasm-release/5.7 from release/5.7
2 parents 11b208a + ad300cf commit ab4b5ca

13 files changed

+553
-52
lines changed

lib/SILGen/SILGenProlog.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,15 @@ SILValue SILGenFunction::emitLoadActorExecutor(SILLocation loc,
768768
else
769769
actorV = actor.borrow(*this, loc).getValue();
770770

771+
// Open an existential actor type.
772+
CanType actorType = actor.getType().getASTType();
773+
if (actorType->isExistentialType()) {
774+
actorType = OpenedArchetypeType::get(
775+
actorType, F.getGenericSignature())->getCanonicalType();
776+
SILType loweredActorType = getLoweredType(actorType);
777+
actorV = B.createOpenExistentialRef(loc, actorV, loweredActorType);
778+
}
779+
771780
// For now, we just want to emit a hop_to_executor directly to the
772781
// actor; LowerHopToActor will add the emission logic necessary later.
773782
return actorV;

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,6 +3060,11 @@ Optional<ActorIsolation> ConformanceChecker::checkActorIsolation(
30603060
diagnoseNonSendableTypesInReference(
30613061
getConcreteWitness(), DC, loc, SendableCheckReason::Conformance);
30623062

3063+
// If the witness is accessible across actors, we don't need to consider it
3064+
// isolated.
3065+
if (isAccessibleAcrossActors(witness, refResult.isolation, DC))
3066+
return None;
3067+
30633068
if (refResult.isolation.isActorIsolated() && isAsyncDecl(requirement) &&
30643069
!isAsyncDecl(witness))
30653070
return refResult.isolation;

stdlib/public/BackDeployConcurrency/CheckedContinuation.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ internal final class CheckedContinuationCanary: @unchecked Sendable {
119119
/// you can replace one with the other in most circumstances,
120120
/// without making other changes.
121121
@available(SwiftStdlib 5.1, *)
122-
public struct CheckedContinuation<T, E: Error> {
122+
public struct CheckedContinuation<T, E: Error>: Sendable {
123123
private let canary: CheckedContinuationCanary
124124

125125
/// Creates a checked continuation from an unsafe continuation.
@@ -186,9 +186,6 @@ public struct CheckedContinuation<T, E: Error> {
186186
}
187187
}
188188

189-
@available(SwiftStdlib 5.1, *)
190-
extension CheckedContinuation: Sendable where T: Sendable { }
191-
192189
@available(SwiftStdlib 5.1, *)
193190
extension CheckedContinuation {
194191
/// Resume the task awaiting the continuation by having it either

stdlib/public/BackDeployConcurrency/PartialAsyncTask.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public struct UnownedJob: Sendable {
6969
/// without making other changes.
7070
@available(SwiftStdlib 5.1, *)
7171
@frozen
72-
public struct UnsafeContinuation<T, E: Error> {
72+
public struct UnsafeContinuation<T, E: Error>: Sendable {
7373
@usableFromInline internal var context: Builtin.RawUnsafeContinuation
7474

7575
@_alwaysEmitIntoClient
@@ -144,9 +144,6 @@ public struct UnsafeContinuation<T, E: Error> {
144144
}
145145
}
146146

147-
@available(SwiftStdlib 5.1, *)
148-
extension UnsafeContinuation: Sendable where T: Sendable { }
149-
150147
@available(SwiftStdlib 5.1, *)
151148
extension UnsafeContinuation {
152149
/// Resume the task that's awaiting the continuation

stdlib/public/Concurrency/CheckedContinuation.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ internal final class CheckedContinuationCanary: @unchecked Sendable {
119119
/// you can replace one with the other in most circumstances,
120120
/// without making other changes.
121121
@available(SwiftStdlib 5.1, *)
122-
public struct CheckedContinuation<T, E: Error> {
122+
public struct CheckedContinuation<T, E: Error>: Sendable {
123123
private let canary: CheckedContinuationCanary
124124

125125
/// Creates a checked continuation from an unsafe continuation.
@@ -186,9 +186,6 @@ public struct CheckedContinuation<T, E: Error> {
186186
}
187187
}
188188

189-
@available(SwiftStdlib 5.1, *)
190-
extension CheckedContinuation: Sendable where T: Sendable { }
191-
192189
@available(SwiftStdlib 5.1, *)
193190
extension CheckedContinuation {
194191
/// Resume the task awaiting the continuation by having it either

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public struct UnownedJob: Sendable {
6969
/// without making other changes.
7070
@available(SwiftStdlib 5.1, *)
7171
@frozen
72-
public struct UnsafeContinuation<T, E: Error> {
72+
public struct UnsafeContinuation<T, E: Error>: Sendable {
7373
@usableFromInline internal var context: Builtin.RawUnsafeContinuation
7474

7575
@_alwaysEmitIntoClient
@@ -144,9 +144,6 @@ public struct UnsafeContinuation<T, E: Error> {
144144
}
145145
}
146146

147-
@available(SwiftStdlib 5.1, *)
148-
extension UnsafeContinuation: Sendable where T: Sendable { }
149-
150147
@available(SwiftStdlib 5.1, *)
151148
extension UnsafeContinuation {
152149
/// Resume the task that's awaiting the continuation

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import Swift
6565
/// use the `withThrowingTaskGroup(of:returning:body:)` method instead.
6666
@available(SwiftStdlib 5.1, *)
6767
@_silgen_name("$ss13withTaskGroup2of9returning4bodyq_xm_q_mq_ScGyxGzYaXEtYar0_lF")
68+
@_unsafeInheritExecutor
6869
@inlinable
6970
public func withTaskGroup<ChildTaskResult, GroupResult>(
7071
of childTaskResultType: ChildTaskResult.Type,
@@ -157,6 +158,7 @@ public func withTaskGroup<ChildTaskResult, GroupResult>(
157158
/// or to let the group rethrow the error.
158159
@available(SwiftStdlib 5.1, *)
159160
@_silgen_name("$ss21withThrowingTaskGroup2of9returning4bodyq_xm_q_mq_Scgyxs5Error_pGzYaKXEtYaKr0_lF")
161+
@_unsafeInheritExecutor
160162
@inlinable
161163
public func withThrowingTaskGroup<ChildTaskResult, GroupResult>(
162164
of childTaskResultType: ChildTaskResult.Type,

0 commit comments

Comments
 (0)