@@ -599,6 +599,20 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
599599 return try await _taskGroupWaitNext ( group: _group)
600600 }
601601
602+ @_silgen_name ( " $sScg10nextResults0B0Oyxq_GSgyYaKF " )
603+ @usableFromInline
604+ mutating func nextResultForABI( ) async throws -> Result < ChildTaskResult , Failure > ? {
605+ do {
606+ guard let success: ChildTaskResult = try await _taskGroupWaitNext ( group: _group) else {
607+ return nil
608+ }
609+
610+ return . success( success)
611+ } catch {
612+ return . failure( error as! Failure ) // as!-safe, because we are only allowed to throw Failure (Error)
613+ }
614+ }
615+
602616 /// Wait for the next child task to complete,
603617 /// and return a result containing either
604618 /// the value that the child task returned or the error that it threw.
@@ -632,16 +646,9 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
632646 /// containing the error that the child task threw.
633647 ///
634648 /// - SeeAlso: `next()`
635- public mutating func nextResult( ) async throws -> Result < ChildTaskResult , Failure > ? {
636- do {
637- guard let success: ChildTaskResult = try await _taskGroupWaitNext ( group: _group) else {
638- return nil
639- }
640-
641- return . success( success)
642- } catch {
643- return . failure( error as! Failure ) // as!-safe, because we are only allowed to throw Failure (Error)
644- }
649+ @_alwaysEmitIntoClient
650+ public mutating func nextResult( ) async -> Result < ChildTaskResult , Failure > ? {
651+ return try ! await nextResultForABI ( )
645652 }
646653
647654 /// A Boolean value that indicates whether the group has any remaining tasks.
0 commit comments