Skip to content

Commit 56c2b34

Browse files
committed
[Features] Rename the BuiltinBuildTaskExecutor feature guard.
The name of the `TaskExecutor` protocol was recently changed to remove underscores after the feature was accepted in Swift Evolution. An implication of that rename is that the `buildOrdinaryTaskExecutorRef` builtin changed the type that it expected as the argument. However, the original change landed in the standard library which as since produced swiftinterfaces that contain the following inlinable code: ``` @inlinable public init<E>(ordinary executor: __shared E) where E : _Concurrency._TaskExecutor { #if $BuiltinBuildTaskExecutor self.executor = Builtin.buildOrdinaryTaskExecutorRef(executor) #else fatalError("Swift compiler is incompatible with this SDK version") #endif } ``` When a compiler containing the protocol rename attempts to type check the above inlinable code, it crashes because the builtin is expecting an argument conforming to `TaskExecutor`, which doesn't exist in this version of the standard library. The issue is that the current compiler still supports the `$BuiltinBuildTaskExecutor` feature guard, but the builtin supported has since changed. To resolve this issue, we need to stop supporting the `$BuiltinBuildTaskExecutor` feature guard and introduce a new one that is only supported by compiler versions that contain the rename. This approach relies on nothing having adopted the API, otherwise we would need to stage in the rename as a parallel set of APIs, and only remove the old APIs once nothing is relying on the old _Concurrency swiftinterfaces.
1 parent 6a3bacd commit 56c2b34

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ LANGUAGE_FEATURE(BuiltinHopToActor, 0, "Builtin.HopToActor")
7777
LANGUAGE_FEATURE(BuiltinTaskGroupWithArgument, 0, "TaskGroup builtins")
7878
LANGUAGE_FEATURE(InheritActorContext, 0, "@_inheritActorContext attribute")
7979
LANGUAGE_FEATURE(ImplicitSelfCapture, 0, "@_implicitSelfCapture attribute")
80-
LANGUAGE_FEATURE(BuiltinBuildTaskExecutor, 0, "TaskExecutor-building builtins")
80+
LANGUAGE_FEATURE(BuiltinBuildTaskExecutorRef, 0, "TaskExecutor-building builtins")
8181
LANGUAGE_FEATURE(BuiltinBuildExecutor, 0, "Executor-building builtins")
8282
LANGUAGE_FEATURE(BuiltinBuildComplexEqualityExecutor, 0, "Executor-building for 'complexEquality executor' builtins")
8383
LANGUAGE_FEATURE(BuiltinBuildMainExecutor, 0, "MainActor executor building builtin")

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3230,7 +3230,7 @@ static bool usesFeatureBuiltinExecutor(Decl *decl) {
32303230
return usesBuiltinType(decl, BuiltinTypeKind::BuiltinExecutor);
32313231
}
32323232

3233-
static bool usesFeatureBuiltinBuildTaskExecutor(Decl *decl) { return false; }
3233+
static bool usesFeatureBuiltinBuildTaskExecutorRef(Decl *decl) { return false; }
32343234

32353235
static bool usesFeatureBuiltinBuildExecutor(Decl *decl) {
32363236
return false;

stdlib/public/Concurrency/Executor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public struct UnownedTaskExecutor: Sendable {
294294

295295
@inlinable
296296
public init<E: TaskExecutor>(ordinary executor: __shared E) {
297-
#if $BuiltinBuildTaskExecutor
297+
#if $BuiltinBuildTaskExecutorRef
298298
self.executor = Builtin.buildOrdinaryTaskExecutorRef(executor)
299299
#else
300300
fatalError("Swift compiler is incompatible with this SDK version")

0 commit comments

Comments
 (0)