2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
5
- // Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
5
+ // Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
6
6
// Licensed under Apache License v2.0 with Runtime Library Exception
7
7
//
8
8
// See https://swift.org/LICENSE.txt for license information
@@ -26,7 +26,7 @@ import SwiftShims
26
26
/// - Returns: Whether or not there is sufficient space on the stack to allocate
27
27
/// `byteCount` bytes of memory.
28
28
@_alwaysEmitIntoClient @_transparent
29
- internal func _byteCountForTemporaryAllocation< T> (
29
+ internal func _byteCountForTemporaryAllocation< T: ~ Copyable > (
30
30
of type: T . Type ,
31
31
capacity: Int
32
32
) -> Int {
@@ -124,7 +124,7 @@ 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
- internal func _withUnsafeTemporaryAllocation< T, R> (
127
+ internal func _withUnsafeTemporaryAllocation< T: ~ Copyable , R/*FIXME(NCG): ~Copyable*/ > (
128
128
of type: T . Type ,
129
129
capacity: Int ,
130
130
alignment: Int ,
@@ -167,7 +167,9 @@ internal func _withUnsafeTemporaryAllocation<T, R>(
167
167
}
168
168
169
169
@_alwaysEmitIntoClient @_transparent
170
- internal func _withUnprotectedUnsafeTemporaryAllocation< T, R> (
170
+ internal func _withUnprotectedUnsafeTemporaryAllocation<
171
+ T: ~ Copyable, R/*FIXME(NCG): ~Copyable*/
172
+ > (
171
173
of type: T . Type ,
172
174
capacity: Int ,
173
175
alignment: Int ,
@@ -214,7 +216,7 @@ internal func _withUnprotectedUnsafeTemporaryAllocation<T, R>(
214
216
}
215
217
216
218
@_alwaysEmitIntoClient @_transparent
217
- internal func _fallBackToHeapAllocation< R> (
219
+ internal func _fallBackToHeapAllocation< R: ~ Copyable > (
218
220
byteCount: Int ,
219
221
alignment: Int ,
220
222
_ body: ( Builtin . RawPointer ) throws -> R
@@ -263,7 +265,7 @@ internal func _fallBackToHeapAllocation<R>(
263
265
/// the buffer) must not escape. It will be deallocated when `body` returns and
264
266
/// cannot be used afterward.
265
267
@_alwaysEmitIntoClient @_transparent
266
- public func withUnsafeTemporaryAllocation< R> (
268
+ public func withUnsafeTemporaryAllocation< R/*FIXME(NCG): ~Copyable*/ > (
267
269
byteCount: Int ,
268
270
alignment: Int ,
269
271
_ body: ( UnsafeMutableRawBufferPointer ) throws -> R
@@ -287,7 +289,7 @@ public func withUnsafeTemporaryAllocation<R>(
287
289
/// This function is similar to `withUnsafeTemporaryAllocation`, except that it
288
290
/// doesn't trigger stack protection for the stack allocated memory.
289
291
@_alwaysEmitIntoClient @_transparent
290
- public func _withUnprotectedUnsafeTemporaryAllocation< R> (
292
+ public func _withUnprotectedUnsafeTemporaryAllocation< R/*FIXME(NCG): ~Copyable*/ > (
291
293
byteCount: Int ,
292
294
alignment: Int ,
293
295
_ body: ( UnsafeMutableRawBufferPointer ) throws -> R
@@ -337,7 +339,7 @@ public func _withUnprotectedUnsafeTemporaryAllocation<R>(
337
339
/// the buffer) must not escape. It will be deallocated when `body` returns and
338
340
/// cannot be used afterward.
339
341
@_alwaysEmitIntoClient @_transparent
340
- public func withUnsafeTemporaryAllocation< T, R> (
342
+ public func withUnsafeTemporaryAllocation< T: ~ Copyable , R/*FIXME(NCG): ~Copyable*/ > (
341
343
of type: T . Type ,
342
344
capacity: Int ,
343
345
_ body: ( UnsafeMutableBufferPointer < T > ) throws -> R
@@ -362,7 +364,7 @@ public func withUnsafeTemporaryAllocation<T, R>(
362
364
/// This function is similar to `withUnsafeTemporaryAllocation`, except that it
363
365
/// doesn't trigger stack protection for the stack allocated memory.
364
366
@_alwaysEmitIntoClient @_transparent
365
- public func _withUnprotectedUnsafeTemporaryAllocation< T, R> (
367
+ public func _withUnprotectedUnsafeTemporaryAllocation< T: ~ Copyable , R/*FIXME(NCG): ~Copyable*/ > (
366
368
of type: T . Type ,
367
369
capacity: Int ,
368
370
_ body: ( UnsafeMutableBufferPointer < T > ) throws -> R
0 commit comments