Skip to content

Commit 9e8d65f

Browse files
authored
Merge pull request #30033 from gottesmm/pr-89ff0d5130b608cdfae1e68dfc8c4b10de0f78cd
[stdlib] Change _withUnsafeGuaranteedRef to use Builtin.convertUnownedUnsafeToGuaranteed.
2 parents 2ffeb36 + 7820ddc commit 9e8d65f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/public/core/Unmanaged.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ public struct Unmanaged<Instance: AnyObject> {
206206
public func _withUnsafeGuaranteedRef<Result>(
207207
_ body: (Instance) throws -> Result
208208
) rethrows -> Result {
209-
let (guaranteedInstance, token) = Builtin.unsafeGuaranteed(_value)
210-
let result = try body(guaranteedInstance)
211-
Builtin.unsafeGuaranteedEnd(token)
212-
return result
209+
var tmp = self
210+
let fakeBase: Int? = nil
211+
return try body(Builtin.convertUnownedUnsafeToGuaranteed(fakeBase,
212+
&tmp._value))
213213
}
214214

215215
/// Performs an unbalanced retain of the object.

0 commit comments

Comments
 (0)