[Future] Add unsafelyOverrideLifetime(of:to:)

This commit is contained in:
Karoy Lorentey committed 2024-08-19 19:44:12 -07:00
1 parent 75aa5b0755
commit c0802bd93f
3 files changed
+28

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ add_library(Future
"Cell.swift"
"ContiguousStorage.swift"
"Inout.swift"
"LifetimeOverride.swift"
"RawSpan.swift"
"Span.swift"
"Containers/Container.swift"
+23
View File
@@ -0,0 +1,23 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import Builtin
@_unsafeNonescapableResult
public func unsafelyOverrideLifetime<
T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable
>(
of dependent: consuming T,
to source: borrowing U
) -> dependsOn(source) T {
dependent
}
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
7D380E072C6BFB9B00AD8F58 /* LifetimeOverride.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D380E062C6BFB9500AD8F58 /* LifetimeOverride.swift */; };
7D9B859729E4F74400B291CD /* BitArray+Shifts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859129E4F74400B291CD /* BitArray+Shifts.swift */; };
7D9B859829E4F74400B291CD /* BitArray+Descriptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859229E4F74400B291CD /* BitArray+Descriptions.swift */; };
7D9B859929E4F74400B291CD /* BitArray+LosslessStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859329E4F74400B291CD /* BitArray+LosslessStringConvertible.swift */; };
@@ -437,6 +438,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
7D380E062C6BFB9500AD8F58 /* LifetimeOverride.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LifetimeOverride.swift; sourceTree = "<group>"; };
7D5A64D229CCE8CC00CB2595 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
7D5A64D329CCEE9A00CB2595 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
7D5A64D429CCEF1500CB2595 /* generate-sources.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "generate-sources.sh"; sourceTree = "<group>"; };
@@ -1808,6 +1810,7 @@
children = (
7DEBEC1B2C5AE43C00A1BF15 /* Containers */,
7DEBEC1C2C5AE43C00A1BF15 /* Box.swift */,
7D380E062C6BFB9500AD8F58 /* LifetimeOverride.swift */,
7DEBEC1D2C5AE43C00A1BF15 /* Cell.swift */,
7DEBEC1E2C5AE43C00A1BF15 /* CMakeLists.txt */,
7DEBEC1F2C5AE43C00A1BF15 /* ContiguousStorage.swift */,
@@ -1959,6 +1962,7 @@
7DE9213629CA70F4004483EB /* TreeSet+SetAlgebra basics.swift in Sources */,
7DE9202C29CA70F3004483EB /* OrderedSet+Initializers.swift in Sources */,
7DE9213229CA70F4004483EB /* TreeSet+SetAlgebra formSymmetricDifference.swift in Sources */,
7D380E072C6BFB9B00AD8F58 /* LifetimeOverride.swift in Sources */,
7DE9203429CA70F3004483EB /* OrderedSet+Partial SetAlgebra formUnion.swift in Sources */,
7DE9214A29CA70F4004483EB /* _HashNode+Subtree Insertions.swift in Sources */,
7DE9215829CA70F4004483EB /* _HashNode+Structural union.swift in Sources */,