Skip to content

Commit 3c30530

Browse files
committed
Note that UnownedSerialExecutor needs to be @unsafe
1 parent d2d4f6b commit 3c30530

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

proposals/nnnn-strict-memory-safety.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,14 @@ In the standard library, the following functions and types would be marked `@uns
227227

228228
* `Unsafe(Mutable)(Raw)(Buffer)Pointer`, `OpaquePointer`, `CVaListPointer`: These types provide neither lifetime nor bounds safety. Over time, Swift code is likely to move toward their safe replacements, such as `(Raw)Span`.
229229
* `(Closed)Range.init(uncheckedBounds:)`: This operation makes it possible to create a range that doesn't satisfy invariants on which other bounds safety checking (e.g., in `Array.subscript`)
230+
* `Span.subscript(unchecked:)` : An unchecked subscript whose use can introduce bounds safety problems.
230231
* `Unmanaged`: Wrapper over reference-counted types that explicitly disables reference counting, potentially introducing lifetime safety issues.
231232
* `unsafeBitCast`: Allows type casts that are not known to be safe, which can introduce type safety problems.
232-
* `unsafeDowncast`: An unchecked form of an `as!` cast that can introduce type safety problems.
233+
* `unsafeDowncast`: An unchecked form of an `as!` cast that can introduce type safety problems.
233234
* `Optional.unsafelyUnwrapped`: An unchecked form of the postfix `!` operation on optionals that can introduce various type, initialization, or lifetime safety problems when `nil` is interpreted as a typed value.
234235
* `UnsafeContinuation`, `withUnsafe(Throwing)Continuation`: An unsafe form of `withChecked(Throwing)Continuation` that does not verify that the continuation is called exactly once, which can cause various safety problems.
235236
* `withUnsafeCurrentTask` and `UnsafeCurrentTask`: The `UnsafeCurrentTask` type does not provide lifetime safety, and must only be used within the closure passed to `withUnsafeCurrentTask`.
236-
* `Span.subscript(unchecked:)` : An unchecked subscript whose use can introduce bounds safety problems.
237+
* `UnownedSerialExecutor`: This type is intentionally not lifetime safe. It's primary use is the `unownedExecutor` property of the `Actor` protocol, which documents the lifetime assumptions of the `UnownedSerialExecutor` instance it produces.
237238

238239
All of these APIs will be marked `@unsafe`. For all of the types that are `@unsafe`, any API that uses that type in its signature will also be marked `@unsafe`, such as `Array.withUnsafeBufferPointer`. Unless mentioned above, standard library APIs that do not have an unsafe type in their signature, but use unsafe constructs in their implementation, will be marked `@safe(unchecked)` because they provide safe abstractions to client code.
239240

0 commit comments

Comments
 (0)