diff --git a/stdlib/public/core/LifetimeManager.swift b/stdlib/public/core/LifetimeManager.swift index eeaeba32b2484..4939333732dfc 100644 --- a/stdlib/public/core/LifetimeManager.swift +++ b/stdlib/public/core/LifetimeManager.swift @@ -290,13 +290,11 @@ public func _copy(_ value: T) -> T { @_alwaysEmitIntoClient @_transparent @lifetime(borrow source) -internal func _overrideLifetime< +public func _overrideLifetime< T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable >( _ dependent: consuming T, borrowing source: borrowing U ) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. dependent } @@ -308,13 +306,11 @@ internal func _overrideLifetime< @_alwaysEmitIntoClient @_transparent @lifetime(copy source) -internal func _overrideLifetime< +public func _overrideLifetime< T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable >( _ dependent: consuming T, copying source: borrowing U ) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. dependent } @@ -326,13 +322,11 @@ internal func _overrideLifetime< @_alwaysEmitIntoClient @_transparent @lifetime(&source) -internal func _overrideLifetime< +public func _overrideLifetime< T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable >( _ dependent: consuming T, mutating source: inout U ) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. dependent } diff --git a/test/ModuleInterface/Inputs/lifetime_dependence.swift b/test/ModuleInterface/Inputs/lifetime_dependence.swift index 8c04ab6867d72..8ffdaf1e82090 100644 --- a/test/ModuleInterface/Inputs/lifetime_dependence.swift +++ b/test/ModuleInterface/Inputs/lifetime_dependence.swift @@ -1,21 +1,3 @@ -@_unsafeNonescapableResult -@_alwaysEmitIntoClient -@_transparent -@lifetime(borrow source) -internal func _overrideLifetime( - _ dependent: consuming T, borrowing source: borrowing U) -> T { - dependent -} - -@_unsafeNonescapableResult -@_alwaysEmitIntoClient -@_transparent -@lifetime(copy source) -internal func _overrideLifetime( - _ dependent: consuming T, copying source: borrowing U) -> T { - dependent -} - public struct AnotherView : ~Escapable { @usableFromInline let _ptr: UnsafeRawBufferPointer @usableFromInline let _count: Int diff --git a/test/SIL/explicit_lifetime_dependence_specifiers.swift b/test/SIL/explicit_lifetime_dependence_specifiers.swift index 1d74064d689ca..4872d19ab6a9b 100644 --- a/test/SIL/explicit_lifetime_dependence_specifiers.swift +++ b/test/SIL/explicit_lifetime_dependence_specifiers.swift @@ -8,30 +8,6 @@ import Builtin -@_unsafeNonescapableResult -@lifetime(borrow source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, borrowing source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - -@_unsafeNonescapableResult -@lifetime(copy source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, copying source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - struct BufferView : ~Escapable { let ptr: UnsafeRawBufferPointer // CHECK-LABEL: sil hidden @$s39explicit_lifetime_dependence_specifiers10BufferViewVyACSWcfC : $@convention(method) (UnsafeRawBufferPointer, @thin BufferView.Type) -> @lifetime(borrow 0) @owned BufferView { diff --git a/test/SIL/implicit_lifetime_dependence.swift b/test/SIL/implicit_lifetime_dependence.swift index 181235c3b7daa..c70d5ddccb408 100644 --- a/test/SIL/implicit_lifetime_dependence.swift +++ b/test/SIL/implicit_lifetime_dependence.swift @@ -5,30 +5,6 @@ // REQUIRES: swift_feature_LifetimeDependence -@_unsafeNonescapableResult -@lifetime(borrow source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, borrowing source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - -@_unsafeNonescapableResult -@lifetime(copy source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, copying source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - struct BufferView : ~Escapable { let ptr: UnsafeRawBufferPointer let c: Int diff --git a/test/SIL/lifetime_dependence_span_lifetime_attr.swift b/test/SIL/lifetime_dependence_span_lifetime_attr.swift index 4d478b19b2523..8771b788a3b2d 100644 --- a/test/SIL/lifetime_dependence_span_lifetime_attr.swift +++ b/test/SIL/lifetime_dependence_span_lifetime_attr.swift @@ -5,30 +5,6 @@ // REQUIRES: swift_in_compiler // REQUIRES: swift_feature_LifetimeDependence -@_unsafeNonescapableResult -@lifetime(borrow source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, borrowing source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - -@_unsafeNonescapableResult -@lifetime(copy source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, copying source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - // TODO: Use real Range public struct FakeRange { public let lowerBound: Bound diff --git a/test/SILOptimizer/Inputs/SpanExtras.swift b/test/SILOptimizer/Inputs/SpanExtras.swift index 881ac3d998b26..29ddeb2817d39 100644 --- a/test/SILOptimizer/Inputs/SpanExtras.swift +++ b/test/SILOptimizer/Inputs/SpanExtras.swift @@ -1,56 +1,5 @@ import Builtin -/// Unsafely discard any lifetime dependency on the `dependent` argument. Return -/// a value identical to `dependent` with a lifetime dependency on the caller's -/// borrow scope of the `source` argument. -@unsafe -@_unsafeNonescapableResult -@_alwaysEmitIntoClient -@_transparent -@lifetime(borrow source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, borrowing source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - -/// Unsafely discard any lifetime dependency on the `dependent` argument. Return -/// a value identical to `dependent` that inherits all lifetime dependencies from -/// the `source` argument. -@unsafe -@_unsafeNonescapableResult -@_alwaysEmitIntoClient -@_transparent -@lifetime(copy source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, copying source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - -@unsafe -@_unsafeNonescapableResult -@_alwaysEmitIntoClient -@_transparent -@lifetime(&source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, mutating source: inout U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - // A MutableSpan represents a span of memory which // contains initialized `Element` instances. @frozen diff --git a/test/SILOptimizer/addressable_dependencies.swift b/test/SILOptimizer/addressable_dependencies.swift index 2b05f43d757db..a9a54f51cdf12 100644 --- a/test/SILOptimizer/addressable_dependencies.swift +++ b/test/SILOptimizer/addressable_dependencies.swift @@ -6,14 +6,6 @@ import Builtin -// Copied from the stdlib until we have Builtin.overrideLifetime. -@_unsafeNonescapableResult -@lifetime(borrow source) -internal func _overrideLifetime( - _ dependent: consuming T, borrowing source: borrowing U) -> T { - dependent -} - struct NodeRef: ~Escapable { private var parent: UnsafePointer diff --git a/test/SILOptimizer/lifetime_dependence/dependence_insertion.swift b/test/SILOptimizer/lifetime_dependence/dependence_insertion.swift index f3cf707c6e9b4..0fc2b1578bec0 100644 --- a/test/SILOptimizer/lifetime_dependence/dependence_insertion.swift +++ b/test/SILOptimizer/lifetime_dependence/dependence_insertion.swift @@ -17,19 +17,6 @@ import Builtin -@unsafe -@_unsafeNonescapableResult -@_alwaysEmitIntoClient -@_transparent -@lifetime(borrow source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, borrowing source: borrowing U -) -> T { - dependent -} - struct BV : ~Escapable { let p: UnsafeRawPointer let i: Int diff --git a/test/SILOptimizer/lifetime_dependence/lifetime_dependence_mutate.swift b/test/SILOptimizer/lifetime_dependence/lifetime_dependence_mutate.swift index e880a0dac7d07..0f7f361bd694e 100644 --- a/test/SILOptimizer/lifetime_dependence/lifetime_dependence_mutate.swift +++ b/test/SILOptimizer/lifetime_dependence/lifetime_dependence_mutate.swift @@ -8,48 +8,6 @@ // REQUIRES: swift_in_compiler // REQUIRES: swift_feature_LifetimeDependence -/// Unsafely discard any lifetime dependency on the `dependent` argument. Return -/// a value identical to `dependent` with a lifetime dependency on the caller's -/// borrow scope of the `source` argument. -@_unsafeNonescapableResult -@_transparent -@lifetime(borrow source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, borrowing source: borrowing U -) -> T { - dependent -} - -/// Unsafely discard any lifetime dependency on the `dependent` argument. Return -/// a value identical to `dependent` that inherits all lifetime dependencies from -/// the `source` argument. -@_unsafeNonescapableResult -@_transparent -@lifetime(copy source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, copying source: borrowing U -) -> T { - dependent -} - -/// Unsafely discard any lifetime dependency on the `dependent` argument. Return -/// a value identical to `dependent` that inherits all lifetime dependencies from -/// the `source` argument. -@_unsafeNonescapableResult -@_transparent -@lifetime(&source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, mutating source: inout U -) -> T { - dependent -} - struct MutableSpan : ~Escapable, ~Copyable { let base: UnsafeMutableRawPointer let count: Int diff --git a/test/SILOptimizer/lifetime_dependence/semantics.swift b/test/SILOptimizer/lifetime_dependence/semantics.swift index 7a2e012532932..1d98624cfaabf 100644 --- a/test/SILOptimizer/lifetime_dependence/semantics.swift +++ b/test/SILOptimizer/lifetime_dependence/semantics.swift @@ -15,49 +15,6 @@ import Builtin -@_unsafeNonescapableResult -@_transparent -@lifetime(borrow source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, borrowing source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - -/// Unsafely discard any lifetime dependency on the `dependent` argument. Return -/// a value identical to `dependent` that inherits all lifetime dependencies from -/// the `source` argument. -@_unsafeNonescapableResult -@_transparent -@lifetime(copy source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, copying source: borrowing U -) -> T { - // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence - // should be expressed by a builtin that is hidden within the function body. - dependent -} - -/// Unsafely discard any lifetime dependency on the `dependent` argument. Return -/// a value identical to `dependent` that inherits all lifetime dependencies from -/// the `source` argument. -@_unsafeNonescapableResult -@_transparent -@lifetime(&source) -internal func _overrideLifetime< - T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable ->( - _ dependent: consuming T, mutating source: inout U -) -> T { - dependent -} - struct NotEscapable: ~Escapable {} // Lifetime dependence semantics by example.