@@ -82,13 +82,12 @@ extension RawSpan {
82
82
83
83
/// Unsafely create a `RawSpan` over initialized memory.
84
84
///
85
- /// The memory in `buffer` must be owned by the instance `owner`,
86
- /// meaning that as long as `owner` is alive the memory will remain valid.
85
+ /// The memory in `buffer` must remain valid, initialized and immutable
86
+ /// throughout the lifetime of the newly-created `RawSpan`.
87
+ /// Failure to maintain this invariant results in undefined behaviour.
87
88
///
88
89
/// - Parameters:
89
90
/// - buffer: an `UnsafeRawBufferPointer` to initialized memory.
90
- /// - owner: a binding whose lifetime must exceed that of
91
- /// the newly created `RawSpan`.
92
91
@_disallowFeatureSuppression ( NonescapableTypes)
93
92
@_alwaysEmitIntoClient
94
93
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -101,6 +100,14 @@ extension RawSpan {
101
100
)
102
101
}
103
102
103
+ /// Unsafely create a `RawSpan` over initialized memory.
104
+ ///
105
+ /// The memory in `buffer` must remain valid, initialized and immutable
106
+ /// throughout the lifetime of the newly-created `RawSpan`.
107
+ /// Failure to maintain this invariant results in undefined behaviour.
108
+ ///
109
+ /// - Parameters:
110
+ /// - buffer: an `UnsafeRawBufferPointer` to initialized memory.
104
111
@_disallowFeatureSuppression ( NonescapableTypes)
105
112
@_alwaysEmitIntoClient
106
113
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -113,13 +120,12 @@ extension RawSpan {
113
120
114
121
/// Unsafely create a `RawSpan` over initialized memory.
115
122
///
116
- /// The memory in `buffer` must be owned by the instance `owner`,
117
- /// meaning that as long as `owner` is alive the memory will remain valid.
123
+ /// The memory in `buffer` must remain valid, initialized and immutable
124
+ /// throughout the lifetime of the newly-created `RawSpan`.
125
+ /// Failure to maintain this invariant results in undefined behaviour.
118
126
///
119
127
/// - Parameters:
120
- /// - buffer: an `UnsafeMutableRawBufferPointer` to initialized memory.
121
- /// - owner: a binding whose lifetime must exceed that of
122
- /// the newly created `RawSpan`.
128
+ /// - buffer: an `UnsafeRawBufferPointer` to initialized memory.
123
129
@_disallowFeatureSuppression ( NonescapableTypes)
124
130
@_alwaysEmitIntoClient
125
131
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -142,15 +148,14 @@ extension RawSpan {
142
148
143
149
/// Unsafely create a `RawSpan` over initialized memory.
144
150
///
145
- /// The memory over `count` bytes starting at
146
- /// `pointer` must be owned by the instance `owner`,
147
- /// meaning that as long as `owner` is alive the memory will remain valid.
151
+ /// The region of memory representing `byteCount` bytes starting at `pointer`
152
+ /// must remain valid, initialized and immutable
153
+ /// throughout the lifetime of the newly-created `RawSpan`.
154
+ /// Failure to maintain this invariant results in undefined behaviour.
148
155
///
149
156
/// - Parameters:
150
157
/// - pointer: a pointer to the first initialized byte.
151
158
/// - byteCount: the number of initialized bytes in the span.
152
- /// - owner: a binding whose lifetime must exceed that of
153
- /// the newly created `RawSpan`.
154
159
@_disallowFeatureSuppression ( NonescapableTypes)
155
160
@_alwaysEmitIntoClient
156
161
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -165,13 +170,12 @@ extension RawSpan {
165
170
166
171
/// Unsafely create a `RawSpan` over initialized memory.
167
172
///
168
- /// The memory in `buffer` must be owned by the instance `owner`,
169
- /// meaning that as long as `owner` is alive the memory will remain valid.
173
+ /// The memory in `buffer` must remain valid, initialized and immutable
174
+ /// throughout the lifetime of the newly-created `RawSpan`.
175
+ /// Failure to maintain this invariant results in undefined behaviour.
170
176
///
171
177
/// - Parameters:
172
178
/// - buffer: an `UnsafeRawBufferPointer` to initialized memory.
173
- /// - owner: a binding whose lifetime must exceed that of
174
- /// the newly created `RawSpan`.
175
179
@_disallowFeatureSuppression ( NonescapableTypes)
176
180
@_alwaysEmitIntoClient
177
181
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -184,11 +188,12 @@ extension RawSpan {
184
188
185
189
/// Unsafely create a `RawSpan` over initialized memory.
186
190
///
187
- /// The memory in `buffer` must be valid and initialized
188
- /// for at least as long as the returned `RawSpan` exists.
191
+ /// The memory in `buffer` must remain valid, initialized and immutable
192
+ /// throughout the lifetime of the newly-created `RawSpan`.
193
+ /// Failure to maintain this invariant results in undefined behaviour.
189
194
///
190
195
/// - Parameters:
191
- /// - buffer: a raw buffer to initialized memory.
196
+ /// - buffer: an `UnsafeRawBufferPointer` to initialized memory.
192
197
@_disallowFeatureSuppression ( NonescapableTypes)
193
198
@_alwaysEmitIntoClient
194
199
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -203,13 +208,12 @@ extension RawSpan {
203
208
204
209
/// Unsafely create a `RawSpan` over initialized memory.
205
210
///
206
- /// The memory in `buffer` must be owned by the instance `owner`,
207
- /// meaning that as long as `owner` is alive the memory will remain valid.
211
+ /// The memory in `buffer` must remain valid, initialized and immutable
212
+ /// throughout the lifetime of the newly-created `RawSpan`.
213
+ /// Failure to maintain this invariant results in undefined behaviour.
208
214
///
209
215
/// - Parameters:
210
- /// - buffer: an `UnsafeMutableRawBufferPointer` to initialized memory.
211
- /// - owner: a binding whose lifetime must exceed that of
212
- /// the newly created `RawSpan`.
216
+ /// - buffer: an `UnsafeRawBufferPointer` to initialized memory.
213
217
@_disallowFeatureSuppression ( NonescapableTypes)
214
218
@_alwaysEmitIntoClient
215
219
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -222,11 +226,12 @@ extension RawSpan {
222
226
223
227
/// Unsafely create a `RawSpan` over initialized memory.
224
228
///
225
- /// The memory in `buffer` must be valid and initialized
226
- /// for at least as long as the returned `RawSpan` exists.
229
+ /// The memory in `buffer` must remain valid, initialized and immutable
230
+ /// throughout the lifetime of the newly-created `RawSpan`.
231
+ /// Failure to maintain this invariant results in undefined behaviour.
227
232
///
228
233
/// - Parameters:
229
- /// - buffer: a raw buffer to initialized memory.
234
+ /// - buffer: an `UnsafeRawBufferPointer` to initialized memory.
230
235
@_disallowFeatureSuppression ( NonescapableTypes)
231
236
@_alwaysEmitIntoClient
232
237
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
@@ -241,15 +246,14 @@ extension RawSpan {
241
246
242
247
/// Unsafely create a `RawSpan` over initialized memory.
243
248
///
244
- /// The memory over `count` bytes starting at
245
- /// `pointer` must be owned by the instance `owner`,
246
- /// meaning that as long as `owner` is alive the memory will remain valid.
249
+ /// The region of memory representing `byteCount` bytes starting at `pointer`
250
+ /// must remain valid, initialized and immutable
251
+ /// throughout the lifetime of the newly-created `RawSpan`.
252
+ /// Failure to maintain this invariant results in undefined behaviour.
247
253
///
248
254
/// - Parameters:
249
255
/// - pointer: a pointer to the first initialized byte.
250
256
/// - byteCount: the number of initialized bytes in the span.
251
- /// - owner: a binding whose lifetime must exceed that of
252
- /// the newly created `RawSpan`.
253
257
@_disallowFeatureSuppression ( NonescapableTypes)
254
258
@_alwaysEmitIntoClient
255
259
//FIXME: should be @lifetime(borrow <argname>) rdar://138672380
0 commit comments