@@ -167,9 +167,11 @@ extension Mach.Port where RightType == Mach.ReceiveRight {
167
167
/// After this function completes, the Mach.Port is destroyed and no longer
168
168
/// usable.
169
169
@inlinable
170
- public __consuming func relinquish(
170
+ public consuming func relinquish(
171
171
) -> ( name: mach_port_name_t , context: mach_port_context_t ) {
172
- return ( name: _name, context: _context)
172
+ let destructured = ( name: _name, context: _context)
173
+ discard self
174
+ return destructured
173
175
}
174
176
175
177
/// Remove guard and transfer ownership of the underlying port right to
@@ -187,9 +189,11 @@ extension Mach.Port where RightType == Mach.ReceiveRight {
187
189
/// Mach.ReceiveRights. Use relinquish() to avoid the syscall and extract
188
190
/// the context value along with the port name.
189
191
@inlinable
190
- public __consuming func unguardAndRelinquish( ) -> mach_port_name_t {
191
- _machPrecondition ( mach_port_unguard ( mach_task_self_, _name, _context) )
192
- return _name
192
+ public consuming func unguardAndRelinquish( ) -> mach_port_name_t {
193
+ let ( name, context) = ( _name, _context)
194
+ discard self
195
+ _machPrecondition ( mach_port_unguard ( mach_task_self_, name, context) )
196
+ return name
193
197
}
194
198
195
199
/// Borrow access to the port name in a block that can perform
@@ -288,8 +292,10 @@ extension Mach.Port where RightType == Mach.SendRight {
288
292
/// After this function completes, the Mach.Port is destroyed and no longer
289
293
/// usable.
290
294
@inlinable
291
- public __consuming func relinquish( ) -> mach_port_name_t {
292
- return _name
295
+ public consuming func relinquish( ) -> mach_port_name_t {
296
+ let name = _name
297
+ discard self
298
+ return name
293
299
}
294
300
295
301
/// Create another send right from a given send right.
@@ -326,8 +332,10 @@ extension Mach.Port where RightType == Mach.SendOnceRight {
326
332
/// After this function completes, the Mach.Port is destroyed and no longer
327
333
/// usable.
328
334
@inlinable
329
- public __consuming func relinquish( ) -> mach_port_name_t {
330
- return _name
335
+ public consuming func relinquish( ) -> mach_port_name_t {
336
+ let name = _name
337
+ discard self
338
+ return name
331
339
}
332
340
}
333
341
0 commit comments