@@ -99,7 +99,6 @@ public func _withUnprotectedUnsafeMutablePointer<T, Result>(
99
99
#endif
100
100
}
101
101
102
- #if !$Embedded
103
102
/// Invokes the given closure with a pointer to the given argument.
104
103
///
105
104
/// The `withUnsafePointer(to:_:)` function is useful for calling Objective-C
@@ -120,25 +119,27 @@ public func _withUnprotectedUnsafeMutablePointer<T, Result>(
120
119
/// type. If you need to mutate the argument through the pointer, use
121
120
/// `withUnsafeMutablePointer(to:_:)` instead.
122
121
/// - Returns: The return value, if any, of the `body` closure.
122
+ @_alwaysEmitIntoClient
123
123
@inlinable
124
- public func withUnsafePointer< T, Result> (
124
+ public func withUnsafePointer< T, E , Result> (
125
125
to value: T ,
126
- _ body: ( UnsafePointer < T > ) throws -> Result
127
- ) rethrows -> Result
126
+ _ body: ( UnsafePointer < T > ) throws ( E ) -> Result
127
+ ) throws ( E ) -> Result
128
128
{
129
129
return try body ( UnsafePointer < T > ( Builtin . addressOfBorrow ( value) ) )
130
130
}
131
- #else
132
- // TODO: This should be unified with non-embedded Swift.
133
- @inlinable
134
- public func withUnsafePointer< T, E, Result> (
131
+
132
+ /// ABI: Historical withUnsafePointer(to:_:) rethrows, expressed as "throws",
133
+ /// which is ABI-compatible with "rethrows".
134
+ @_silgen_name ( " $ss17withUnsafePointer2to_q_x_q_SPyxGKXEtKr0_lF " )
135
+ @usableFromInline
136
+ func __abi_withUnsafePointer< T, Result> (
135
137
to value: T ,
136
- _ body: ( UnsafePointer < T > ) throws ( E ) -> Result
137
- ) throws ( E ) -> Result
138
+ _ body: ( UnsafePointer < T > ) throws -> Result
139
+ ) throws -> Result
138
140
{
139
141
return try body ( UnsafePointer < T > ( Builtin . addressOfBorrow ( value) ) )
140
142
}
141
- #endif
142
143
143
144
/// Invokes the given closure with a pointer to the given argument.
144
145
///
0 commit comments