Skip to content

Commit 346bbca

Browse files
committed
Concurrency: Remove superfluous $BuiltinCreateAsyncTaskInGroup guards.
1 parent 3aca6b6 commit 346bbca

File tree

3 files changed

+0
-88
lines changed

3 files changed

+0
-88
lines changed

stdlib/public/Concurrency/DiscardingTaskGroup.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ public struct DiscardingTaskGroup {
309309
public mutating func addTaskUnlessCancelled(
310310
operation: sending @escaping @isolated(any) () async -> Void
311311
) -> Bool {
312-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
313312
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
314313

315314
guard canAdd else {
@@ -333,9 +332,6 @@ public struct DiscardingTaskGroup {
333332
operation: operation)
334333

335334
return true
336-
#else
337-
fatalError("Unsupported Swift compiler")
338-
#endif
339335
}
340336

341337
// The Embedded clones of the task-creation routines.
@@ -444,7 +440,6 @@ public struct DiscardingTaskGroup {
444440
public mutating func addTaskUnlessCancelled(
445441
operation: sending @escaping () async -> Void
446442
) -> Bool {
447-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
448443
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
449444

450445
guard canAdd else {
@@ -462,9 +457,6 @@ public struct DiscardingTaskGroup {
462457
_ = Builtin.createAsyncDiscardingTaskInGroup(flags, _group, operation)
463458

464459
return true
465-
#else
466-
fatalError("Unsupported Swift compiler")
467-
#endif
468460
}
469461

470462
#endif // $Embedded
@@ -769,7 +761,6 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
769761
priority: TaskPriority? = nil,
770762
operation: sending @escaping @isolated(any) () async throws -> Void
771763
) {
772-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
773764
let flags = taskCreateFlags(
774765
priority: priority, isChildTask: true, copyTaskLocals: false,
775766
inheritContext: false, enqueueJob: true,
@@ -784,9 +775,6 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
784775
initialSerialExecutor: builtinSerialExecutor,
785776
taskGroup: _group,
786777
operation: operation)
787-
#else
788-
fatalError("Unsupported Swift compiler")
789-
#endif
790778
}
791779

792780
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@@ -798,7 +786,6 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
798786
priority: TaskPriority? = nil,
799787
operation: sending @escaping @isolated(any) () async throws -> Void
800788
) -> Bool {
801-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
802789
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
803790

804791
guard canAdd else {
@@ -822,9 +809,6 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
822809
operation: operation)
823810

824811
return true
825-
#else
826-
fatalError("Unsupported Swift compiler")
827-
#endif
828812
}
829813

830814
/// A Boolean value that indicates whether the group has any remaining tasks.

stdlib/public/Concurrency/Task.swift

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,6 @@ extension Task where Failure == Never {
623623
priority: TaskPriority? = nil,
624624
@_inheritActorContext @_implicitSelfCapture operation: sending @escaping () async -> Success
625625
) {
626-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
627626
// Set up the job flags for a new task.
628627
let flags = taskCreateFlags(
629628
priority: priority, isChildTask: false, copyTaskLocals: true,
@@ -635,9 +634,6 @@ extension Task where Failure == Never {
635634
let (task, _) = Builtin.createAsyncTask(flags, operation)
636635

637636
self._task = task
638-
#else
639-
fatalError("Unsupported Swift compiler")
640-
#endif
641637
}
642638
#else
643639
/// Runs the given nonthrowing operation asynchronously
@@ -670,7 +666,6 @@ extension Task where Failure == Never {
670666
priority: TaskPriority? = nil,
671667
@_inheritActorContext @_implicitSelfCapture operation: sending @escaping @isolated(any) () async -> Success
672668
) {
673-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
674669
// Set up the job flags for a new task.
675670
let flags = taskCreateFlags(
676671
priority: priority, isChildTask: false, copyTaskLocals: true,
@@ -688,9 +683,6 @@ extension Task where Failure == Never {
688683
operation: operation)
689684

690685
self._task = task
691-
#else
692-
fatalError("Unsupported Swift compiler")
693-
#endif
694686
}
695687
#endif
696688
}
@@ -715,7 +707,6 @@ extension Task where Failure == Error {
715707
priority: TaskPriority? = nil,
716708
@_inheritActorContext @_implicitSelfCapture operation: sending @escaping () async throws -> Success
717709
) {
718-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
719710
// Set up the task flags for a new task.
720711
let flags = taskCreateFlags(
721712
priority: priority, isChildTask: false, copyTaskLocals: true,
@@ -727,9 +718,6 @@ extension Task where Failure == Error {
727718
let (task, _) = Builtin.createAsyncTask(flags, operation)
728719

729720
self._task = task
730-
#else
731-
fatalError("Unsupported Swift compiler")
732-
#endif
733721
}
734722
#else
735723
/// Runs the given throwing operation asynchronously
@@ -762,7 +750,6 @@ extension Task where Failure == Error {
762750
priority: TaskPriority? = nil,
763751
@_inheritActorContext @_implicitSelfCapture operation: sending @escaping @isolated(any) () async throws -> Success
764752
) {
765-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
766753
// Set up the task flags for a new task.
767754
let flags = taskCreateFlags(
768755
priority: priority, isChildTask: false, copyTaskLocals: true,
@@ -780,9 +767,6 @@ extension Task where Failure == Error {
780767
operation: operation)
781768

782769
self._task = task
783-
#else
784-
fatalError("Unsupported Swift compiler")
785-
#endif
786770
}
787771
#endif
788772
}
@@ -809,7 +793,6 @@ extension Task where Failure == Never {
809793
priority: TaskPriority? = nil,
810794
operation: sending @escaping () async -> Success
811795
) -> Task<Success, Failure> {
812-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
813796
// Set up the job flags for a new task.
814797
let flags = taskCreateFlags(
815798
priority: priority, isChildTask: false, copyTaskLocals: false,
@@ -821,9 +804,6 @@ extension Task where Failure == Never {
821804
let (task, _) = Builtin.createAsyncTask(flags, operation)
822805

823806
return Task(task)
824-
#else
825-
fatalError("Unsupported Swift compiler")
826-
#endif
827807
}
828808
#else
829809
/// Runs the given nonthrowing operation asynchronously
@@ -853,7 +833,6 @@ extension Task where Failure == Never {
853833
priority: TaskPriority? = nil,
854834
operation: sending @escaping @isolated(any) () async -> Success
855835
) -> Task<Success, Failure> {
856-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
857836
// Set up the job flags for a new task.
858837
let flags = taskCreateFlags(
859838
priority: priority, isChildTask: false, copyTaskLocals: false,
@@ -871,9 +850,6 @@ extension Task where Failure == Never {
871850
operation: operation)
872851

873852
return Task(task)
874-
#else
875-
fatalError("Unsupported Swift compiler")
876-
#endif
877853
}
878854
#endif
879855
}
@@ -898,7 +874,6 @@ extension Task where Failure == Error {
898874
priority: TaskPriority? = nil,
899875
operation: sending @escaping () async throws -> Success
900876
) -> Task<Success, Failure> {
901-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
902877
// Set up the job flags for a new task.
903878
let flags = taskCreateFlags(
904879
priority: priority, isChildTask: false, copyTaskLocals: false,
@@ -910,9 +885,6 @@ extension Task where Failure == Error {
910885
let (task, _) = Builtin.createAsyncTask(flags, operation)
911886

912887
return Task(task)
913-
#else
914-
fatalError("Unsupported Swift compiler")
915-
#endif
916888
}
917889
#else
918890
/// Runs the given throwing operation asynchronously
@@ -944,7 +916,6 @@ extension Task where Failure == Error {
944916
priority: TaskPriority? = nil,
945917
operation: sending @escaping @isolated(any) () async throws -> Success
946918
) -> Task<Success, Failure> {
947-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
948919
// Set up the job flags for a new task.
949920
let flags = taskCreateFlags(
950921
priority: priority, isChildTask: false, copyTaskLocals: false,
@@ -962,9 +933,6 @@ extension Task where Failure == Error {
962933
operation: operation)
963934

964935
return Task(task)
965-
#else
966-
fatalError("Unsupported Swift compiler")
967-
#endif
968936
}
969937
#endif
970938
}

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
331331
priority: TaskPriority? = nil,
332332
operation: sending @escaping @isolated(any) () async -> ChildTaskResult
333333
) {
334-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
335334
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
336335
let flags = taskCreateFlags(
337336
priority: priority, isChildTask: true, copyTaskLocals: false,
@@ -354,9 +353,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
354353
initialSerialExecutor: builtinSerialExecutor,
355354
taskGroup: _group,
356355
operation: operation)
357-
#else
358-
fatalError("Unsupported Swift compiler")
359-
#endif
360356
}
361357

362358
/// Adds a child task to the group, unless the group has been canceled.
@@ -374,7 +370,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
374370
priority: TaskPriority? = nil,
375371
operation: sending @escaping @isolated(any) () async -> ChildTaskResult
376372
) -> Bool {
377-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
378373
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
379374

380375
guard canAdd else {
@@ -404,9 +399,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
404399
operation: operation)
405400

406401
return true
407-
#else
408-
fatalError("Unsupported Swift compiler")
409-
#endif
410402
}
411403

412404
#elseif $Embedded
@@ -416,7 +408,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
416408
priority: TaskPriority? = nil,
417409
operation: sending @escaping () async -> ChildTaskResult
418410
) {
419-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
420411
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
421412
let flags = taskCreateFlags(
422413
priority: priority, isChildTask: true, copyTaskLocals: false,
@@ -434,17 +425,13 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
434425

435426
// Create the task in this group.
436427
_ = Builtin.createAsyncTaskInGroup(flags, _group, operation)
437-
#else
438-
fatalError("Unsupported Swift compiler")
439-
#endif
440428
}
441429

442430
@_alwaysEmitIntoClient
443431
public mutating func addTaskUnlessCancelled(
444432
priority: TaskPriority? = nil,
445433
operation: sending @escaping () async -> ChildTaskResult
446434
) -> Bool {
447-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
448435
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
449436

450437
guard canAdd else {
@@ -469,9 +456,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
469456
_ = Builtin.createAsyncTaskInGroup(flags, _group, operation)
470457

471458
return true
472-
#else
473-
fatalError("Unsupported Swift compiler")
474-
#endif
475459
}
476460

477461
#else // if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@@ -494,7 +478,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
494478
public mutating func addTask(
495479
operation: sending @escaping @isolated(any) () async -> ChildTaskResult
496480
) {
497-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
498481
let flags = taskCreateFlags(
499482
priority: nil, isChildTask: true, copyTaskLocals: false,
500483
inheritContext: false, enqueueJob: true,
@@ -508,9 +491,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
508491
initialSerialExecutor: builtinSerialExecutor,
509492
taskGroup: _group,
510493
operation: operation)
511-
#else
512-
fatalError("Unsupported Swift compiler")
513-
#endif
514494
}
515495

516496
@available(SwiftStdlib 5.7, *)
@@ -533,7 +513,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
533513
public mutating func addTaskUnlessCancelled(
534514
operation: sending @escaping @isolated(any) () async -> ChildTaskResult
535515
) -> Bool {
536-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
537516
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
538517

539518
guard canAdd else {
@@ -556,9 +535,6 @@ public struct TaskGroup<ChildTaskResult: Sendable> {
556535
operation: operation)
557536

558537
return true
559-
#else
560-
fatalError("Unsupported Swift compiler")
561-
#endif
562538
}
563539
#endif
564540

@@ -860,7 +836,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
860836
priority: TaskPriority? = nil,
861837
operation: sending @escaping @isolated(any) () async throws -> ChildTaskResult
862838
) {
863-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
864839
let flags = taskCreateFlags(
865840
priority: priority, isChildTask: true, copyTaskLocals: false,
866841
inheritContext: false, enqueueJob: true,
@@ -875,9 +850,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
875850
initialSerialExecutor: builtinSerialExecutor,
876851
taskGroup: _group,
877852
operation: operation)
878-
#else
879-
fatalError("Unsupported Swift compiler")
880-
#endif
881853
}
882854

883855
/// Adds a child task to the group, unless the group has been canceled.
@@ -898,7 +870,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
898870
priority: TaskPriority? = nil,
899871
operation: sending @escaping @isolated(any) () async throws -> ChildTaskResult
900872
) -> Bool {
901-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
902873
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
903874

904875
guard canAdd else {
@@ -921,9 +892,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
921892
operation: operation)
922893

923894
return true
924-
#else
925-
fatalError("Unsupported Swift compiler")
926-
#endif
927895
}
928896
#else
929897
@available(SwiftStdlib 5.7, *)
@@ -946,7 +914,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
946914
public mutating func addTask(
947915
operation: sending @escaping () async throws -> ChildTaskResult
948916
) {
949-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
950917
let flags = taskCreateFlags(
951918
priority: nil, isChildTask: true, copyTaskLocals: false,
952919
inheritContext: false, enqueueJob: true,
@@ -955,9 +922,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
955922

956923
// Create the task in this group.
957924
_ = Builtin.createAsyncTaskInGroup(flags, _group, operation)
958-
#else
959-
fatalError("Unsupported Swift compiler")
960-
#endif
961925
}
962926

963927
@available(SwiftStdlib 5.7, *)
@@ -982,7 +946,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
982946
public mutating func addTaskUnlessCancelled(
983947
operation: sending @escaping () async throws -> ChildTaskResult
984948
) -> Bool {
985-
#if compiler(>=5.5) && $BuiltinCreateAsyncTaskInGroup
986949
let canAdd = _taskGroupAddPendingTask(group: _group, unconditionally: false)
987950

988951
guard canAdd else {
@@ -1000,9 +963,6 @@ public struct ThrowingTaskGroup<ChildTaskResult: Sendable, Failure: Error> {
1000963
_ = Builtin.createAsyncTaskInGroup(flags, _group, operation)
1001964

1002965
return true
1003-
#else
1004-
fatalError("Unsupported Swift compiler")
1005-
#endif
1006966
}
1007967
#endif
1008968

0 commit comments

Comments
 (0)