@@ -124,8 +124,9 @@ internal func _isStackAllocationSafe(byteCount: Int, alignment: Int) -> Bool {
124124/// This function encapsulates the various calls to builtins required by
125125/// `withUnsafeTemporaryAllocation()`.
126126@_alwaysEmitIntoClient @_transparent
127- // FIXME(NCG): R needs to be ~Copyable too, but that leads to lifetime failures (rdar://124571365).
128- internal func _withUnsafeTemporaryAllocation< T: ~ Copyable, R> (
127+ internal func _withUnsafeTemporaryAllocation<
128+ T: ~ Copyable, R: ~ Copyable
129+ > (
129130 of type: T . Type ,
130131 capacity: Int ,
131132 alignment: Int ,
@@ -169,8 +170,7 @@ internal func _withUnsafeTemporaryAllocation<T: ~Copyable, R>(
169170
170171@_alwaysEmitIntoClient @_transparent
171172internal func _withUnprotectedUnsafeTemporaryAllocation<
172- // FIXME(NCG): R needs to be ~Copyable too, but that leads to lifetime failures (rdar://124571365).
173- T: ~ Copyable, R
173+ T: ~ Copyable, R: ~ Copyable
174174> (
175175 of type: T . Type ,
176176 capacity: Int ,
@@ -267,8 +267,7 @@ internal func _fallBackToHeapAllocation<R: ~Copyable>(
267267/// the buffer) must not escape. It will be deallocated when `body` returns and
268268/// cannot be used afterward.
269269@_alwaysEmitIntoClient @_transparent
270- // FIXME(NCG): R needs to be ~Copyable, but that leads to lifetime failures (rdar://124571365).
271- public func withUnsafeTemporaryAllocation< R> (
270+ public func withUnsafeTemporaryAllocation< R: ~ Copyable> (
272271 byteCount: Int ,
273272 alignment: Int ,
274273 _ body: ( UnsafeMutableRawBufferPointer ) throws -> R
@@ -292,8 +291,7 @@ public func withUnsafeTemporaryAllocation<R>(
292291/// This function is similar to `withUnsafeTemporaryAllocation`, except that it
293292/// doesn't trigger stack protection for the stack allocated memory.
294293@_alwaysEmitIntoClient @_transparent
295- // FIXME(NCG): R needs to be ~Copyable, but that leads to lifetime failures (rdar://124571365).
296- public func _withUnprotectedUnsafeTemporaryAllocation< R> (
294+ public func _withUnprotectedUnsafeTemporaryAllocation< R: ~ Copyable> (
297295 byteCount: Int ,
298296 alignment: Int ,
299297 _ body: ( UnsafeMutableRawBufferPointer ) throws -> R
@@ -343,8 +341,9 @@ public func _withUnprotectedUnsafeTemporaryAllocation<R>(
343341/// the buffer) must not escape. It will be deallocated when `body` returns and
344342/// cannot be used afterward.
345343@_alwaysEmitIntoClient @_transparent
346- // FIXME(NCG): R needs to be ~Copyable too, but that leads to lifetime failures (rdar://124571365).
347- public func withUnsafeTemporaryAllocation< T: ~ Copyable, R> (
344+ public func withUnsafeTemporaryAllocation<
345+ T: ~ Copyable, R: ~ Copyable
346+ > (
348347 of type: T . Type ,
349348 capacity: Int ,
350349 _ body: ( UnsafeMutableBufferPointer < T > ) throws -> R
@@ -369,8 +368,9 @@ public func withUnsafeTemporaryAllocation<T: ~Copyable, R>(
369368/// This function is similar to `withUnsafeTemporaryAllocation`, except that it
370369/// doesn't trigger stack protection for the stack allocated memory.
371370@_alwaysEmitIntoClient @_transparent
372- // FIXME(NCG): R needs to be ~Copyable too, but that leads to lifetime failures (rdar://124571365).
373- public func _withUnprotectedUnsafeTemporaryAllocation< T: ~ Copyable, R> (
371+ public func _withUnprotectedUnsafeTemporaryAllocation<
372+ T: ~ Copyable, R: ~ Copyable
373+ > (
374374 of type: T . Type ,
375375 capacity: Int ,
376376 _ body: ( UnsafeMutableBufferPointer < T > ) throws -> R
0 commit comments