Skip to content

Commit aa43d60

Browse files
committed
Frontend: Introduce an alias for the IsolatedAny experimental feature.
To preserve compatibility with older compilers that do not allow `IsolatedAny` to be enabled in production compilers, use an alias experimental feature when building the stdlib (`IsolatedAny2`). Also, add `@_allowFeatureSuppression(IsolatedAny)` in a couple spots it was forgotten. Partially resolves rdar://125138945
1 parent 3607096 commit aa43d60

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

include/swift/Basic/Features.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ EXPERIMENTAL_FEATURE(ClosureIsolation, true)
361361
// Enable isolated(any) attribute on function types.
362362
CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE(IsolatedAny, true)
363363

364+
// Alias for IsolatedAny
365+
EXPERIMENTAL_FEATURE(IsolatedAny2, true)
366+
364367
#undef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
365368
#undef EXPERIMENTAL_FEATURE
366369
#undef UPCOMING_FEATURE

lib/AST/FeatureSet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,8 @@ static bool usesFeatureIsolatedAny(Decl *decl) {
681681
});
682682
}
683683

684+
UNINTERESTING_FEATURE(IsolatedAny2)
685+
684686
// ----------------------------------------------------------------------------
685687
// MARK: - FeatureSet
686688
// ----------------------------------------------------------------------------

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
886886

887887
if (*feature == Feature::NoncopyableGenerics2)
888888
Opts.enableFeature(Feature::NoncopyableGenerics);
889+
890+
if (*feature == Feature::IsolatedAny2)
891+
Opts.enableFeature(Feature::IsolatedAny);
889892
}
890893

891894
// Hack: In order to support using availability macros in SPM packages, we

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ endif()
6262

6363
list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
6464
"-enable-experimental-feature"
65-
"IsolatedAny"
65+
"IsolatedAny2"
6666
)
6767

6868
list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
782782
/// to set the child task's priority to the priority of the group.
783783
/// - operation: The operation to execute as part of the task group.
784784
@_alwaysEmitIntoClient
785+
@_allowFeatureSuppression(IsolatedAny)
785786
public mutating func addTask(
786787
priority: TaskPriority? = nil,
787788
operation: __owned @Sendable @escaping @isolated(any) () async throws -> ChildTaskResult
@@ -823,6 +824,7 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
823824
/// - Returns: `true` if the child task was added to the group;
824825
/// otherwise `false`.
825826
@_alwaysEmitIntoClient
827+
@_allowFeatureSuppression(IsolatedAny)
826828
public mutating func addTaskUnlessCancelled(
827829
priority: TaskPriority? = nil,
828830
operation: __owned @Sendable @escaping @isolated(any) () async throws -> ChildTaskResult

test/ModuleInterface/isolated_any_suppression.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %empty-directory(%t)
22

33
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -module-name isolated_any -emit-module -o %t/isolated_any.swiftmodule -emit-module-interface-path - -enable-experimental-feature IsolatedAny %s | %FileCheck %s
4+
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -module-name isolated_any -emit-module -o %t/isolated_any.swiftmodule -emit-module-interface-path - -enable-experimental-feature IsolatedAny2 %s | %FileCheck %s
45

56
// CHECK: #if compiler(>=5.3) && $IsolatedAny
67
// CHECK-NEXT: {{^}}public func test1(fn: @isolated(any) @Sendable () -> ())

0 commit comments

Comments
 (0)