@@ -124,8 +124,9 @@ internal func _isStackAllocationSafe(byteCount: Int, alignment: Int) -> Bool {
124
124
/// This function encapsulates the various calls to builtins required by
125
125
/// `withUnsafeTemporaryAllocation()`.
126
126
@_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
+ > (
129
130
of type: T . Type ,
130
131
capacity: Int ,
131
132
alignment: Int ,
@@ -169,8 +170,7 @@ internal func _withUnsafeTemporaryAllocation<T: ~Copyable, R>(
169
170
170
171
@_alwaysEmitIntoClient @_transparent
171
172
internal 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
174
174
> (
175
175
of type: T . Type ,
176
176
capacity: Int ,
@@ -267,8 +267,7 @@ internal func _fallBackToHeapAllocation<R: ~Copyable>(
267
267
/// the buffer) must not escape. It will be deallocated when `body` returns and
268
268
/// cannot be used afterward.
269
269
@_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> (
272
271
byteCount: Int ,
273
272
alignment: Int ,
274
273
_ body: ( UnsafeMutableRawBufferPointer ) throws -> R
@@ -292,8 +291,7 @@ public func withUnsafeTemporaryAllocation<R>(
292
291
/// This function is similar to `withUnsafeTemporaryAllocation`, except that it
293
292
/// doesn't trigger stack protection for the stack allocated memory.
294
293
@_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> (
297
295
byteCount: Int ,
298
296
alignment: Int ,
299
297
_ body: ( UnsafeMutableRawBufferPointer ) throws -> R
@@ -343,8 +341,9 @@ public func _withUnprotectedUnsafeTemporaryAllocation<R>(
343
341
/// the buffer) must not escape. It will be deallocated when `body` returns and
344
342
/// cannot be used afterward.
345
343
@_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
+ > (
348
347
of type: T . Type ,
349
348
capacity: Int ,
350
349
_ body: ( UnsafeMutableBufferPointer < T > ) throws -> R
@@ -369,8 +368,9 @@ public func withUnsafeTemporaryAllocation<T: ~Copyable, R>(
369
368
/// This function is similar to `withUnsafeTemporaryAllocation`, except that it
370
369
/// doesn't trigger stack protection for the stack allocated memory.
371
370
@_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
+ > (
374
374
of type: T . Type ,
375
375
capacity: Int ,
376
376
_ body: ( UnsafeMutableBufferPointer < T > ) throws -> R
0 commit comments