Skip to content

Commit a24998a

Browse files
author
Max Moiseev
committed
[stdlib] Add missing @_fixed_layout attributes to fix resilience build
1 parent 71015dc commit a24998a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+126
-1
lines changed

stdlib/public/core/ASCII.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ extension Unicode.ASCII : Unicode.Encoding {
6464
return encode(FromEncoding.decode(content))
6565
}
6666

67+
@_fixed_layout // FIXME(sil-serialize-all)
6768
public struct Parser {
6869
@_inlineable // FIXME(sil-serialize-all)
6970
public init() { }

stdlib/public/core/AnyHashable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ internal protocol _AnyHashableBox {
5353
func _downCastConditional<T>(into result: UnsafeMutablePointer<T>) -> Bool
5454
}
5555

56+
@_fixed_layout // FIXME(sil-serialize-all)
5657
@_versioned // FIXME(sil-serialize-all)
5758
internal struct _ConcreteHashableBox<Base : Hashable> : _AnyHashableBox {
5859
@_versioned // FIXME(sil-serialize-all)
@@ -141,6 +142,7 @@ internal func _getBridgedCustomAnyHashable<T>(_ value: T) -> AnyHashable? {
141142
/// print(descriptions[AnyHashable(43)]) // prints "nil"
142143
/// print(descriptions[AnyHashable(Int8(43))]!) // prints "an Int8"
143144
/// print(descriptions[AnyHashable(Set(["a", "b"]))]!) // prints "a set of strings"
145+
@_fixed_layout // FIXME(sil-serialize-all)
144146
public struct AnyHashable {
145147
@_versioned // FIXME(sil-serialize-all)
146148
internal var _box: _AnyHashableBox

stdlib/public/core/ArrayCast.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public func _arrayForceCast<SourceElement, TargetElement>(
5252
return source.map { $0 as! TargetElement }
5353
}
5454

55+
@_fixed_layout // FIXME(sil-serialize-all)
5556
@_versioned // FIXME(sil-serialize-all)
5657
internal struct _UnwrappingFailed : Error {
5758
@_inlineable // FIXME(sil-serialize-all)

stdlib/public/core/CharacterUnicodeScalars.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
extension Character {
13+
@_fixed_layout // FIXME(sil-serialize-all)
1314
public struct UnicodeScalarView {
1415
@_versioned // FIXME(sil-serialize-all)
1516
internal let _base: Character
@@ -28,6 +29,7 @@ extension Character {
2829
}
2930

3031
extension Character.UnicodeScalarView {
32+
@_fixed_layout // FIXME(sil-serialize-all)
3133
public struct Iterator {
3234
@_versioned // FIXME(sil-serialize-all)
3335
internal var _base: IndexingIterator<Character.UnicodeScalarView>

stdlib/public/core/Codable.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ public protocol KeyedEncodingContainerProtocol {
418418

419419
/// A concrete container that provides a view into an encoder's storage, making
420420
/// the encoded properties of an encodable type accessible by keys.
421+
@_fixed_layout // FIXME(sil-serialize-all)
421422
public struct KeyedEncodingContainer<K : CodingKey> : KeyedEncodingContainerProtocol {
422423
public typealias Key = K
423424

@@ -1167,6 +1168,7 @@ public protocol KeyedDecodingContainerProtocol {
11671168

11681169
/// A concrete container that provides a view into an decoder's storage, making
11691170
/// the encoded properties of an decodable type accessible by keys.
1171+
@_fixed_layout // FIXME(sil-serialize-all)
11701172
public struct KeyedDecodingContainer<K : CodingKey> : KeyedDecodingContainerProtocol {
11711173
public typealias Key = K
11721174

@@ -2441,6 +2443,7 @@ public protocol SingleValueDecodingContainer {
24412443
//===----------------------------------------------------------------------===//
24422444

24432445
/// A user-defined key for providing context during encoding and decoding.
2446+
@_fixed_layout // FIXME(sil-serialize-all)
24442447
public struct CodingUserInfoKey : RawRepresentable, Equatable, Hashable {
24452448
public typealias RawValue = String
24462449

@@ -2478,6 +2481,7 @@ public struct CodingUserInfoKey : RawRepresentable, Equatable, Hashable {
24782481
/// An error that occurs during the encoding of a value.
24792482
public enum EncodingError : Error {
24802483
/// The context in which the error occurred.
2484+
@_fixed_layout // FIXME(sil-serialize-all)
24812485
public struct Context {
24822486
/// The path of coding keys taken to get to the point of the failing encode call.
24832487
public let codingPath: [CodingKey]
@@ -2551,6 +2555,7 @@ public enum EncodingError : Error {
25512555
/// An error that occurs during the decoding of a value.
25522556
public enum DecodingError : Error {
25532557
/// The context in which the error occurred.
2558+
@_fixed_layout // FIXME(sil-serialize-all)
25542559
public struct Context {
25552560
/// The path of coding keys taken to get to the point of the failing decode call.
25562561
public let codingPath: [CodingKey]

stdlib/public/core/CollectionOfOne.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
/// An iterator that produces one or fewer instances of `Element`.
14+
@_fixed_layout // FIXME(sil-serialize-all)
1415
public struct IteratorOverOne<Element> : IteratorProtocol, Sequence {
1516
/// Construct an instance that generates `_element!`, or an empty
1617
/// sequence if `_element == nil`.
@@ -39,6 +40,7 @@ public struct IteratorOverOne<Element> : IteratorProtocol, Sequence {
3940
}
4041

4142
/// A collection containing a single element of type `Element`.
43+
@_fixed_layout // FIXME(sil-serialize-all)
4244
public struct CollectionOfOne<Element>
4345
: MutableCollection, RandomAccessCollection {
4446

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ internal var _emptyArrayStorage : _EmptyArrayStorage {
7878
}
7979

8080
// The class that implements the storage for a ContiguousArray<Element>
81+
@_fixed_layout // FIXME(sil-serialize-all)
8182
@_versioned
8283
internal final class _ContiguousArrayStorage<
8384
Element

stdlib/public/core/DoubleWidth.swift.gyb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,14 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
175175
}
176176
}
177177

178+
@_fixed_layout // FIXME(sil-serialize-all)
178179
public struct Words : Collection {
179180
public enum _IndexValue {
180181
case low(Base.Magnitude.Words.Index)
181182
case high(Base.Words.Index)
182183
}
183184

185+
@_fixed_layout // FIXME(sil-serialize-all)
184186
public struct Index : Comparable {
185187
public var _value: _IndexValue
186188

stdlib/public/core/DropWhile.swift.gyb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ from gyb_stdlib_support import (
2525
/// This is the associated iterator for the `LazyDropWhileSequence`,
2626
/// `LazyDropWhileCollection`, and `LazyDropWhileBidirectionalCollection`
2727
/// types.
28+
@_fixed_layout // FIXME(sil-serialize-all)
2829
public struct LazyDropWhileIterator<Base : IteratorProtocol> :
2930
IteratorProtocol, Sequence {
3031

@@ -64,6 +65,7 @@ public struct LazyDropWhileIterator<Base : IteratorProtocol> :
6465

6566
/// A sequence whose elements consist of the elements that follow the initial
6667
/// consecutive elements of some base sequence that satisfy a given predicate.
68+
@_fixed_layout // FIXME(sil-serialize-all)
6769
public struct LazyDropWhileSequence<Base : Sequence> : LazySequenceProtocol {
6870

6971
public typealias Elements = LazyDropWhileSequence
@@ -112,6 +114,7 @@ extension LazySequenceProtocol {
112114

113115
/// A position in a `LazyDropWhileCollection` or
114116
/// `LazyDropWhileBidirectionalCollection` instance.
117+
@_fixed_layout // FIXME(sil-serialize-all)
115118
public struct LazyDropWhileIndex<Base : Collection> : Comparable {
116119
/// The position corresponding to `self` in the underlying collection.
117120
public let base: Base.Index
@@ -151,6 +154,7 @@ public struct LazyDropWhileIndex<Base : Collection> : Comparable {
151154
/// performance given by the `Collection` protocol. Be aware, therefore,
152155
/// that general operations on `${Self}` instances may not have the
153156
/// documented complexity.
157+
@_fixed_layout // FIXME(sil-serialize-all)
154158
public struct ${Self}<
155159
Base : ${Collection}
156160
> : LazyCollectionProtocol, ${Collection} {

stdlib/public/core/EmptyCollection.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
//===----------------------------------------------------------------------===//
1919

2020
/// An iterator that never produces an element.
21+
@_fixed_layout // FIXME(sil-serialize-all)
2122
public struct EmptyIterator<Element> : IteratorProtocol, Sequence {
2223
/// Creates an instance.
2324
@_inlineable // FIXME(sil-serialize-all)
@@ -31,6 +32,7 @@ public struct EmptyIterator<Element> : IteratorProtocol, Sequence {
3132
}
3233

3334
/// A collection whose element type is `Element` but that is always empty.
35+
@_fixed_layout // FIXME(sil-serialize-all)
3436
public struct EmptyCollection<Element> :
3537
RandomAccessCollection, MutableCollection
3638
{

stdlib/public/core/Existential.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// Policy.swift. Similar components should usually be defined next to
1515
// their respective protocols.
1616

17+
@_fixed_layout // FIXME(sil-serialize-all)
1718
@_versioned // FIXME(sil-serialize-all)
1819
internal struct _CollectionOf<
1920
IndexType : Strideable, Element

stdlib/public/core/Filter.swift.gyb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ from gyb_stdlib_support import (
2121
///
2222
/// - Note: This is the associated `Iterator` of `LazyFilterSequence`
2323
/// and `LazyFilterCollection`.
24+
@_fixed_layout // FIXME(sil-serialize-all)
2425
public struct LazyFilterIterator<
2526
Base : IteratorProtocol
2627
> : IteratorProtocol, Sequence {
@@ -70,6 +71,7 @@ public struct LazyFilterIterator<
7071
///
7172
/// - Note: `s.lazy.filter { ... }`, for an arbitrary sequence `s`,
7273
/// is a `LazyFilterSequence`.
74+
@_fixed_layout // FIXME(sil-serialize-all)
7375
public struct LazyFilterSequence<Base : Sequence>
7476
: LazySequenceProtocol {
7577

@@ -124,6 +126,7 @@ public typealias LazyFilterIndex<Base : Collection> = Base.Index
124126
/// the usual performance given by `Collection`. Be aware, therefore, that
125127
/// general operations on `LazyFilterCollection` instances may not have the
126128
/// documented complexity.
129+
@_fixed_layout // FIXME(sil-serialize-all)
127130
public struct ${Self}<
128131
Base : ${collectionForTraversal(Traversal)}
129132
> : LazyCollectionProtocol, ${collectionForTraversal(Traversal)}

stdlib/public/core/Flatten.swift.gyb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ from gyb_stdlib_support import (
2626
///
2727
/// - Note: This is the `IteratorProtocol` used by `FlattenSequence`,
2828
/// `FlattenCollection`, and `BidirectionalFlattenCollection`.
29+
@_fixed_layout // FIXME(sil-serialize-all)
2930
public struct FlattenIterator<Base : IteratorProtocol> : IteratorProtocol, Sequence
3031
where Base.Element : Sequence {
3132

@@ -82,6 +83,7 @@ public struct FlattenIterator<Base : IteratorProtocol> : IteratorProtocol, Seque
8283
/// * `s.lazy.joined().map(f)` maps lazily and returns a `LazyMapSequence`
8384
///
8485
/// - See also: `FlattenCollection`
86+
@_fixed_layout // FIXME(sil-serialize-all)
8587
public struct FlattenSequence<Base : Sequence> : Sequence
8688
where Base.Element : Sequence {
8789

@@ -157,6 +159,7 @@ extension LazySequenceProtocol where Element : Sequence {
157159
% Index = Collection + 'Index'
158160
% Slice = sliceTypeName(traversal=traversal, mutable=False, rangeReplaceable=False)
159161
/// A position in a `${Collection}`.
162+
@_fixed_layout // FIXME(sil-serialize-all)
160163
public struct ${Index}<BaseElements>
161164
where
162165
BaseElements : ${collectionForTraversal(traversal)},
@@ -239,6 +242,7 @@ extension ${Index} : Comparable {
239242
/// documented complexity.
240243
///
241244
/// - See also: `FlattenSequence`
245+
@_fixed_layout // FIXME(sil-serialize-all)
242246
public struct ${Collection}<Base> : ${collectionForTraversal(traversal)}
243247
where
244248
Base : ${collectionForTraversal(traversal)},

stdlib/public/core/HashedCollections.swift.gyb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,6 +2553,7 @@ extension Dictionary {
25532553
}
25542554

25552555
/// A view of a dictionary's keys.
2556+
@_fixed_layout // FIXME(sil-serialize-all)
25562557
public struct Keys : Collection, Equatable {
25572558
public typealias Element = Key
25582559

@@ -3129,6 +3130,7 @@ collections = [
31293130
// NOTE: The precise layout of this type is relied on in the runtime
31303131
// to provide a statically allocated empty singleton.
31313132
// See stdlib/public/stubs/GlobalObjects.cpp for details.
3133+
@_fixed_layout // FIXME(sil-serialize-all)
31323134
@_versioned // FIXME(sil-serialize-all)
31333135
@objc_non_lazy_realization
31343136
internal class _RawNative${Self}Storage:
@@ -3289,6 +3291,7 @@ internal class _RawNative${Self}Storage:
32893291
}
32903292

32913293
// See the docs at the top of this file for a description of this type
3294+
@_fixed_layout // FIXME(sil-serialize-all)
32923295
@_versioned
32933296
internal class _TypedNative${Self}Storage<${TypeParameters}> :
32943297
_RawNative${Self}Storage {
@@ -3358,6 +3361,7 @@ internal class _TypedNative${Self}Storage<${TypeParameters}> :
33583361

33593362

33603363
// See the docs at the top of this file for a description of this type
3364+
@_fixed_layout // FIXME(sil-serialize-all)
33613365
@_versioned
33623366
final internal class _HashableTypedNative${Self}Storage<${TypeParametersDecl}> :
33633367
_TypedNative${Self}Storage<${TypeParameters}> {
@@ -4183,6 +4187,7 @@ extension _Native${Self}Buffer
41834187
#if _runtime(_ObjC)
41844188
/// An NSEnumerator that works with any Native${Self}Buffer of
41854189
/// verbatim bridgeable elements. Used by the various NS${Self} impls.
4190+
@_fixed_layout // FIXME(sil-serialize-all)
41864191
@_versioned // FIXME(sil-serialize-all)
41874192
final internal class _Native${Self}NSEnumerator<${TypeParameters}>
41884193
: _SwiftNativeNSEnumerator, _NSEnumerator {
@@ -4268,6 +4273,7 @@ final internal class _Native${Self}NSEnumerator<${TypeParameters}>
42684273
/// This is the fallback implementation for situations where toll-free bridging
42694274
/// isn't possible. On first access, a Native${Self}Buffer of AnyObject will be
42704275
/// constructed containing all the bridged elements.
4276+
@_fixed_layout // FIXME(sil-serialize-all)
42714277
@_versioned // FIXME(sil-serialize-all)
42724278
final internal class _SwiftDeferredNS${Self}<${TypeParametersDecl}>
42734279
: _SwiftNativeNS${Self}, _NS${Self}Core {
@@ -5727,6 +5733,7 @@ internal enum _Variant${Self}Buffer<${TypeParametersDecl}> : _HashBuffer {
57275733
compareOperators = ["<", "<=", ">", ">=", "=="]
57285734
}%
57295735

5736+
@_fixed_layout // FIXME(sil-serialize-all)
57305737
@_versioned
57315738
internal struct _Native${Self}Index<${TypeParameters}> : Comparable {
57325739
@_versioned
@@ -5756,6 +5763,7 @@ extension _Native${Self}Index {
57565763

57575764

57585765
#if _runtime(_ObjC)
5766+
@_fixed_layout // FIXME(sil-serialize-all)
57595767
@_versioned
57605768
internal struct _Cocoa${Self}Index : Comparable {
57615769
// Assumption: we rely on NSDictionary.getObjects when being
@@ -5879,6 +5887,7 @@ elif Self == 'Dictionary':
58795887
}%
58805888

58815889
${SubscriptingWithIndexDoc}
5890+
@_fixed_layout // FIXME(sil-serialize-all)
58825891
public struct Index : Comparable {
58835892
// Index for native buffer is efficient. Index for bridged NS${Self} is
58845893
// not, because neither NSEnumerator nor fast enumeration support moving
@@ -6004,6 +6013,7 @@ extension ${Self}.Index {
60046013
}
60056014

60066015
#if _runtime(_ObjC)
6016+
@_fixed_layout // FIXME(sil-serialize-all)
60076017
@_versioned
60086018
final internal class _Cocoa${Self}Iterator : IteratorProtocol {
60096019
internal typealias Element = ${AnySequenceType}
@@ -6118,6 +6128,7 @@ internal enum ${Self}IteratorRepresentation<${TypeParametersDecl}> {
61186128
}
61196129

61206130
/// An iterator over the members of a `${Self}<${TypeParameters}>`.
6131+
@_fixed_layout // FIXME(sil-serialize-all)
61216132
public struct ${Self}Iterator<${TypeParametersDecl}> : IteratorProtocol {
61226133
// ${Self} has a separate IteratorProtocol and Index because of efficiency
61236134
// and implementability reasons.
@@ -6250,6 +6261,7 @@ extension ${Self} : CustomReflectable {
62506261
///
62516262
/// Using a builder can be faster than inserting members into an empty
62526263
/// `${Self}`.
6264+
@_fixed_layout // FIXME(sil-serialize-all)
62536265
public struct _${Self}Builder<${TypeParametersDecl}> {
62546266
%if Self == 'Set':
62556267
public typealias Key = ${TypeParameters}

stdlib/public/core/HeapBuffer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal protocol _HeapBufferHeader_ {
2020
var value: Value { get set }
2121
}
2222

23+
@_fixed_layout // FIXME(sil-serialize-all)
2324
@_versioned
2425
internal struct _HeapBufferHeader<T> : _HeapBufferHeader_ {
2526
internal typealias Value = T

stdlib/public/core/Integers.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,6 +3182,7 @@ ${assignmentOperatorComment(x.operator, True)}
31823182
}
31833183

31843184
// FIXME should be RandomAccessCollection
3185+
@_fixed_layout // FIXME(sil-serialize-all)
31853186
public struct Words : BidirectionalCollection {
31863187
public typealias Indices = CountableRange<Int>
31873188
public typealias SubSequence = BidirectionalSlice<${Self}.Words>

stdlib/public/core/Join.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal enum _JoinIteratorState {
2020

2121
/// An iterator that presents the elements of the sequences traversed
2222
/// by a base iterator, concatenated using a given separator.
23+
@_fixed_layout // FIXME(sil-serialize-all)
2324
public struct JoinedIterator<Base : IteratorProtocol> : IteratorProtocol
2425
where Base.Element : Sequence {
2526

@@ -95,6 +96,7 @@ public struct JoinedIterator<Base : IteratorProtocol> : IteratorProtocol
9596

9697
/// A sequence that presents the elements of a base sequence of sequences
9798
/// concatenated using a given separator.
99+
@_fixed_layout // FIXME(sil-serialize-all)
98100
public struct JoinedSequence<Base : Sequence> : Sequence
99101
where Base.Element : Sequence {
100102

0 commit comments

Comments
 (0)