mirror of
https://github.com/apple/swift.git
synced 2026-10-26 20:15:53 +01:00
This gates access to the new standard library `Borrow` and `Inout` types until they are officially accepted.
20 lines
574 B
Swift
20 lines
574 B
Swift
// Just enough definition here to test the behavior of referencing the names.
|
|
public struct Borrow<Target: ~Copyable>: ~Escapable {
|
|
@_lifetime(immortal)
|
|
init() {}
|
|
}
|
|
public struct Inout<Target: ~Copyable>: ~Escapable, ~Copyable {
|
|
@_lifetime(immortal)
|
|
init() {}
|
|
}
|
|
|
|
@_marker public protocol Copyable {}
|
|
@_marker public protocol Escapable {}
|
|
|
|
public struct Int {}
|
|
|
|
// Make sure the stdlib is able to refer to its own declarations irrespective
|
|
// of feature flag settings.
|
|
public func referenceBorrow(x: Borrow<Int>) {}
|
|
public func referenceInout(x: consuming Inout<Int>) {}
|