Skip to content

Commit 21872e4

Browse files
authored
Merge pull request #3508 from swiftwasm/release/5.5
[pull] swiftwasm-release/5.5 from release/5.5
2 parents 7a916ee + e6826e3 commit 21872e4

File tree

13 files changed

+1012
-524
lines changed

13 files changed

+1012
-524
lines changed

lib/Sema/DerivedConformanceEquatableHashable.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,12 @@ deriveHashable_hashInto(
557557
hashDecl->copyFormalAccessFrom(derived.Nominal,
558558
/*sourceIsParentContext=*/true);
559559

560+
// The derived hash(into:) for an actor must be non-isolated.
561+
if (derived.Nominal->isActor() ||
562+
getActorIsolation(derived.Nominal) == ActorIsolation::GlobalActor) {
563+
hashDecl->getAttrs().add(new (C) NonisolatedAttr(/*IsImplicit*/true));
564+
}
565+
560566
derived.addMembersToConformanceContext({hashDecl});
561567

562568
return hashDecl;
@@ -912,6 +918,12 @@ static ValueDecl *deriveHashable_hashValue(DerivedConformance &derived) {
912918
hashValueDecl->copyFormalAccessFrom(derived.Nominal,
913919
/*sourceIsParentContext*/ true);
914920

921+
// The derived hashValue of an actor must be nonisolated.
922+
if (derived.Nominal->isActor() ||
923+
getActorIsolation(derived.Nominal) == ActorIsolation::GlobalActor) {
924+
hashValueDecl->getAttrs().add(new (C) NonisolatedAttr(/*IsImplicit*/true));
925+
}
926+
915927
Pattern *hashValuePat = NamedPattern::createImplicit(C, hashValueDecl);
916928
hashValuePat->setType(intType);
917929
hashValuePat = TypedPattern::createImplicit(C, hashValuePat, intType);

stdlib/public/Concurrency/AsyncStream.swift

Lines changed: 255 additions & 95 deletions
Large diffs are not rendered by default.

stdlib/public/Concurrency/AsyncThrowingStream.swift

Lines changed: 312 additions & 65 deletions
Large diffs are not rendered by default.

stdlib/public/Concurrency/Executor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
import Swift
1414

15-
/// A service which can execute jobs.
15+
/// A service that can execute jobs.
1616
@available(SwiftStdlib 5.5, *)
1717
public protocol Executor: AnyObject, Sendable {
1818
func enqueue(_ job: UnownedJob)
1919
}
2020

21-
/// A service which can execute jobs.
21+
/// A service that executes jobs.
2222
@available(SwiftStdlib 5.5, *)
2323
public protocol SerialExecutor: Executor {
2424
// This requirement is repeated here as a non-override so that we

stdlib/public/Concurrency/GlobalActor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import Swift
1515
/// A type that represents a globally-unique actor that can be used to isolate
1616
/// various declarations anywhere in the program.
1717
///
18-
/// A type that conforms to the `GlobalActor` protocol and is marked with the
18+
/// A type that conforms to the `GlobalActor` protocol and is marked with
1919
/// the `@globalActor` attribute can be used as a custom attribute. Such types
2020
/// are called global actor types, and can be applied to any declaration to
2121
/// specify that such types are isolated to that global actor type. When using
2222
/// such a declaration from another actor (or from nonisolated code),
23-
/// synchronization is performed through the \c shared actor instance to ensure
23+
/// synchronization is performed through the shared actor instance to ensure
2424
/// mutually-exclusive access to the declaration.
2525
@available(SwiftStdlib 5.5, *)
2626
public protocol GlobalActor {

stdlib/public/Concurrency/Task.swift

Lines changed: 189 additions & 177 deletions
Large diffs are not rendered by default.

stdlib/public/Concurrency/TaskCancellation.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public func withTaskCancellationHandler<T>(
4444

4545
@available(SwiftStdlib 5.5, *)
4646
extension Task {
47-
/// Returns `true` if the task is cancelled, and should stop executing.
47+
/// A Boolean value that indicates whether the task should stop executing.
48+
///
49+
/// After the value of this property becomes `true`, it remains `true` indefinitely.
50+
/// There is no way to uncancel a task.
4851
///
4952
/// - SeeAlso: `checkCancellation()`
5053
public var isCancelled: Bool {
@@ -60,10 +63,10 @@ extension Task {
6063

6164
@available(SwiftStdlib 5.5, *)
6265
extension Task where Success == Never, Failure == Never {
63-
/// Returns `true` if the task is cancelled, and should stop executing.
66+
/// A Boolean value that indicates whether the task should stop executing.
6467
///
65-
/// If no current `Task` is available, returns `false`, as outside of a task
66-
/// context no task cancellation may be observed.
68+
/// After the value of this property becomes `true`, it remains `true` indefinitely.
69+
/// There is no way to uncancel a task.
6770
///
6871
/// - SeeAlso: `checkCancellation()`
6972
public static var isCancelled: Bool {
@@ -75,7 +78,7 @@ extension Task where Success == Never, Failure == Never {
7578

7679
@available(SwiftStdlib 5.5, *)
7780
extension Task where Success == Never, Failure == Never {
78-
/// Check if the task is cancelled and throw an `CancellationError` if it was.
81+
/// Throws an error if the task was canceled.
7982
///
8083
/// The error is always an instance of `Task.CancellationError`.
8184
///
@@ -87,10 +90,10 @@ extension Task where Success == Never, Failure == Never {
8790
}
8891
}
8992

90-
/// The default cancellation thrown when a task is cancelled.
93+
/// An error that indicates a task was canceled.
9194
///
9295
/// This error is also thrown automatically by `Task.checkCancellation()`,
93-
/// if the current task has been cancelled.
96+
/// if the current task has been canceled.
9497
@available(SwiftStdlib 5.5, *)
9598
public struct CancellationError: Error {
9699
// no extra information, cancellation is intended to be light-weight

0 commit comments

Comments
 (0)