@@ -2974,3 +2974,53 @@ extension Data : Codable {
29742974 }
29752975 }
29762976}
2977+
2978+ // TODO: remove once _overrideLifetime is public in the standard library
2979+ /// Unsafely discard any lifetime dependency on the `dependent` argument. Return
2980+ /// a value identical to `dependent` with a lifetime dependency on the caller's
2981+ /// borrow scope of the `source` argument.
2982+ @unsafe
2983+ @_unsafeNonescapableResult
2984+ @_alwaysEmitIntoClient
2985+ @_transparent
2986+ @lifetime ( borrow source)
2987+ internal func _overrideLifetime<
2988+ T: ~ Copyable & ~ Escapable, U: ~ Copyable & ~ Escapable
2989+ > (
2990+ _ dependent: consuming T , borrowing source: borrowing U
2991+ ) -> T {
2992+ dependent
2993+ }
2994+
2995+ /// Unsafely discard any lifetime dependency on the `dependent` argument. Return
2996+ /// a value identical to `dependent` that inherits all lifetime dependencies from
2997+ /// the `source` argument.
2998+ @unsafe
2999+ @_unsafeNonescapableResult
3000+ @_alwaysEmitIntoClient
3001+ @_transparent
3002+ @lifetime ( copy source)
3003+ internal func _overrideLifetime<
3004+ T: ~ Copyable & ~ Escapable, U: ~ Copyable & ~ Escapable
3005+ > (
3006+ _ dependent: consuming T , copying source: borrowing U
3007+ ) -> T {
3008+ dependent
3009+ }
3010+
3011+ /// Unsafely discard any lifetime dependency on the `dependent` argument.
3012+ /// Return a value identical to `dependent` with a lifetime dependency
3013+ /// on the caller's exclusive borrow scope of the `source` argument.
3014+ @unsafe
3015+ @_unsafeNonescapableResult
3016+ @_alwaysEmitIntoClient
3017+ @_transparent
3018+ @lifetime ( & source)
3019+ internal func _overrideLifetime<
3020+ T: ~ Copyable & ~ Escapable, U: ~ Copyable & ~ Escapable
3021+ > (
3022+ _ dependent: consuming T ,
3023+ mutating source: inout U
3024+ ) -> T {
3025+ dependent
3026+ }
0 commit comments