@@ -17,7 +17,7 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
1717    self . stateMachine =  ManagedCriticalState ( BoundedBufferStateMachine ( base:  base,  limit:  limit) ) 
1818  } 
1919
20-   func  next( )  async  ->  Result < Base . Element ,  Error > ? { 
20+   func  next( )  async  ->  UnsafeTransfer < Result < Base . Element ,  Error > ? >  { 
2121    return  await  withTaskCancellationHandler  { 
2222      let  action :  BoundedBufferStateMachine < Base > . NextAction ? =  self . stateMachine. withCriticalRegion  { 
2323        stateMachine in 
@@ -45,14 +45,14 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
4545
4646      case  . returnResult( let  producerContinuation,  let  result) : 
4747        producerContinuation? . resume ( ) 
48-         return  result
48+         return  UnsafeTransfer ( result) 
4949
5050      case  . none: 
5151        break 
5252      } 
5353
5454      return  await  withUnsafeContinuation  { 
55-         ( continuation:  UnsafeContinuation < Result < Base . Element ,  Error > ? ,  Never > )  in 
55+         ( continuation:  UnsafeContinuation < UnsafeTransfer < Result < Base . Element ,  Error > ? > ,  Never > )  in 
5656        let  action  =  self . stateMachine. withCriticalRegion  {  stateMachine in 
5757          stateMachine. nextSuspended ( continuation:  continuation) 
5858        } 
@@ -61,7 +61,7 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
6161          break 
6262        case  . returnResult( let  producerContinuation,  let  result) : 
6363          producerContinuation? . resume ( ) 
64-           continuation. resume ( returning:  result) 
64+           continuation. resume ( returning:  UnsafeTransfer ( result) ) 
6565        } 
6666      } 
6767    }  onCancel:  { 
@@ -109,6 +109,7 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
109109          case  . none: 
110110            break 
111111          case  . resumeConsumer( let  continuation,  let  result) : 
112+             
112113            continuation. resume ( returning:  result) 
113114          } 
114115        } 
@@ -120,7 +121,7 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
120121        case  . none: 
121122          break 
122123        case  . resumeConsumer( let  continuation) : 
123-           continuation? . resume ( returning:  nil ) 
124+           continuation? . resume ( returning:  UnsafeTransfer ( nil ) ) 
124125        } 
125126      }  catch  { 
126127        let  action  =  self . stateMachine. withCriticalRegion  {  stateMachine in 
@@ -130,7 +131,7 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
130131        case  . none: 
131132          break 
132133        case  . resumeConsumer( let  continuation) : 
133-           continuation? . resume ( returning:  . failure( error) ) 
134+           continuation? . resume ( returning:  UnsafeTransfer ( Result < Base . Element ,   Error > . failure ( error) ) ) 
134135        } 
135136      } 
136137    } 
@@ -148,7 +149,7 @@ final class BoundedBufferStorage<Base: AsyncSequence>: Sendable where Base: Send
148149    case  . resumeProducerAndConsumer( let  task,  let  producerContinuation,  let  consumerContinuation) : 
149150      task. cancel ( ) 
150151      producerContinuation? . resume ( ) 
151-       consumerContinuation? . resume ( returning:  nil ) 
152+       consumerContinuation? . resume ( returning:  UnsafeTransfer ( nil ) ) 
152153    } 
153154  } 
154155
0 commit comments