Unowned(unsafe) can cause locking with @_noLocks

This code generates compiler error:

"This code performs reference counting operations which can cause locking"

@_noLocks
func unownedUnsafe() {
    unowned(unsafe) let y = self
}

on another hand this code compiles ok:

@_noLocks
func unownedUnsafe2() {
    let y = Unmanaged<SomeClass>.passUnretained(self)
}

Is this genuine error in the first case, as my understanding is that these two examples are roughly the same?

4 Likes