Skip to content

Commit

Permalink
Freeze some types for consistency with their inlinable initializers
Browse files Browse the repository at this point in the history
Note: @Frozen does *not* mean that we actually consider these struct types frozen. Their layout may arbitrarily change between even minor releases.
  • Loading branch information
lorentey committed Aug 30, 2021
1 parent 215ed90 commit 0e9e7f1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/DequeModule/Deque+Collection.swift
Expand Up @@ -16,6 +16,7 @@ extension Deque: Sequence {
// conversions from indices to storage slots.

/// An iterator over the members of a deque.
@frozen
public struct Iterator: IteratorProtocol {
@usableFromInline
internal var _storage: Deque._Storage
Expand Down
1 change: 1 addition & 0 deletions Sources/DequeModule/Deque._Storage.swift
Expand Up @@ -10,6 +10,7 @@
//===----------------------------------------------------------------------===//

extension Deque {
@frozen
@usableFromInline
struct _Storage {
@usableFromInline
Expand Down
1 change: 1 addition & 0 deletions Sources/DequeModule/Deque._UnsafeHandle.swift
Expand Up @@ -10,6 +10,7 @@
//===----------------------------------------------------------------------===//

extension Deque {
@frozen
@usableFromInline
internal struct _UnsafeHandle {
@usableFromInline
Expand Down
1 change: 1 addition & 0 deletions Sources/DequeModule/_DequeBuffer.swift
Expand Up @@ -9,6 +9,7 @@
//
//===----------------------------------------------------------------------===//

@_fixed_layout
@usableFromInline
internal class _DequeBuffer<Element>: ManagedBuffer<_DequeBufferHeader, Element> {
@inlinable
Expand Down
2 changes: 2 additions & 0 deletions Sources/DequeModule/_UnsafeWrappedBuffer.swift
Expand Up @@ -9,6 +9,7 @@
//
//===----------------------------------------------------------------------===//

@frozen
@usableFromInline
internal struct _UnsafeWrappedBuffer<Element> {
@usableFromInline
Expand Down Expand Up @@ -51,6 +52,7 @@ internal struct _UnsafeWrappedBuffer<Element> {
internal var count: Int { first.count + (second?.count ?? 0) }
}

@frozen
@usableFromInline
internal struct _UnsafeMutableWrappedBuffer<Element> {
@usableFromInline
Expand Down
Expand Up @@ -12,6 +12,7 @@
extension OrderedSet {
/// An unordered view into an ordered set, providing `SetAlgebra`
/// conformance.
@frozen
public struct UnorderedView {
public typealias Element = OrderedSet.Element

Expand Down

0 comments on commit 0e9e7f1

Please sign in to comment.