{"push_id":1038420644,"size":1,"distinct_size":1,"ref":"refs/heads/unsafe_guaranteed_prototype","head":"94600ee13a7f93aaa1d210fbcd765fc9b9d9e4ec","before":"51f1d8b26db34e82d811c7712788125b840566b9","commits":[{"sha":"94600ee13a7f93aaa1d210fbcd765fc9b9d9e4ec","author":{"email":"a062a1fc79cf5774407f3aca464d9087f7463c8c@apple.com","name":"Arnold Schwaighofer"},"message":"Add _withUnsafeGuaranteedValue to Unmanaged\n\nThis is an internal method that will go away in the future.\n\nGet the value of the unmanaged referenced as a managed reference without\nconsuming an unbalanced retain of it and pass it to the closure. Asserts\nthat there is some other reference ('the owning reference') to the\nunmanaged reference that guarantees the lifetime of the unmanaged reference\nfor the duration of the '_withUnsafeGuaranteedValue' call.\n\n  var owningReference = Instance()\n  ...\n  withFixedLifetime(owningReference) {\n    let u = Unmanaged.passUnretained(owningReference)\n\n    for i in 0 ..< 100 {\n\n      // Assert that the reference in 'u' is kept alive by another storage\n      // location or value that holds the same reference.\n      u._withUnsafeGuaranteedValue {\n        $0.doSomething()\n      }\n\n    }\n  } // owningReference's lifetime (reference count > 0) is guaranteed\n    // for this scope.","distinct":true,"url":"https://api.github.com/repos/aschwaighofer/swift/commits/94600ee13a7f93aaa1d210fbcd765fc9b9d9e4ec"}]}