Previously, we would emit this as
%1 = load [copy] %address
%2 = moveonly_wrapper_to_copyable [owned] %1
which is difficult for move-only checking to handle, since %2 looks like a
consume of %1, making it difficult to determine %1's true lifetime. Change
this to
%1 = moveonly_wrapper_to_copyable_addr %address
%2 = load [copy] %address
which is handled better by move-only checking, improving the accuracy of
existing move-checking as well as fixing a spurious diagnostic when
indirect parameters get passed as by-value arguments to other functions.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
When a `borrowing` or `consuming` parameter is captured by a closure,
we emit references to the binding within the closure as if it is non-implicitly
copyable, but we didn't mark the bindings inside the closure for move-only
checking to ensure the uses were correct, so improper consumes would go
undiagnosed and lead to assertion failures, compiler crashes, and/or
miscompiles. Fixes rdar://127382105
This fixes the `consuming` and `borrowing` keywords for some basic
cases. In particular, if a nontrivial struct contains a trivial 'let'
field, then this pass would result in invalid SIL types:
class C {}
struct BV {
let p: UnsafeRawPointer
let c: C
}
func getPointer(bv: consuming BV) -> UnsafeRawPointer {
return bv.p
}
Ultimately, this pass makes sense, but there is something strange
about the way move-only-ness propagates into fields of aggregates
which needs to be fixed first. Until then, other features are blocked
on basic support for these keywords.
Fixes rdar://122701694 (`consuming` keyword causes verification error on invalid SIL types)