Files
swift-mirror/test/stdlib/Inputs/BorrowInoutFakeStdlib.swift
Joe Groff 0a16152b40 Add a BorrowInout experimental feature flag.
This gates access to the new standard library `Borrow` and `Inout` types
until they are officially accepted.
2026-02-13 15:23:51 -08:00

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>) {}