Skip to content

Commit 969bfe1

Browse files
committed
[stdlib] Collection types are eagerMove.
Types that have "value semantics" should not have lexical lifetimes. Value types are not expected to have custom deinits. Are not expected to expose unsafe interior pointers. And cannot have weak references because they are structs. Therefore, deinitialization barriers are irrelevant. rdar://107076869
1 parent f5e8fc2 commit 969bfe1

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

stdlib/public/core/Array.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@
297297
/// instances of those types always have a contiguous block of memory as
298298
/// their storage.
299299
@frozen
300+
@_eagerMove
300301
public struct Array<Element>: _DestructorSafeContainer {
301302
#if _runtime(_ObjC)
302303
@usableFromInline

stdlib/public/core/ContiguousArray.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
/// For more information about using arrays, see `Array` and `ArraySlice`, with
3535
/// which `ContiguousArray` shares most properties and methods.
3636
@frozen
37+
@_eagerMove
3738
public struct ContiguousArray<Element>: _DestructorSafeContainer {
3839
@usableFromInline
3940
internal typealias _Buffer = _ContiguousArrayBuffer<Element>

stdlib/public/core/Dictionary.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@
386386
/// optimization that is used when two instances of `Dictionary` share
387387
/// buffer.
388388
@frozen
389+
@_eagerMove
389390
public struct Dictionary<Key: Hashable, Value> {
390391
/// The element type of a dictionary: a tuple containing an individual
391392
/// key-value pair.

stdlib/public/core/Set.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
/// same copy-on-write optimization that is used when two instances of `Set`
145145
/// share buffer.
146146
@frozen
147+
@_eagerMove
147148
public struct Set<Element: Hashable> {
148149
@usableFromInline
149150
internal var _variant: _Variant

stdlib/public/core/String.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ internal func unimplemented_utf8_32bit(
349349
/// [scalars]: http://www.unicode.org/glossary/#unicode_scalar_value
350350
/// [equivalence]: http://www.unicode.org/glossary/#canonical_equivalent
351351
@frozen
352+
@_eagerMove
352353
public struct String {
353354
public // @SPI(Foundation)
354355
var _guts: _StringGuts

0 commit comments

Comments
 (0)