Skip to content

Commit 6783a1a

Browse files
authored
Use Never instead of Void as the fallback lock/mutex type. (#898)
When using WASI without multithreading, or when using a platform to which Swift Testing has been incompletely ported, we don't know what type to use as a lock/mutex, so we use `Void`. However, turns out that produces a diagnostic: > warning: UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer So use `Never` instead. (Yes, this will produce a pointer to an uninitialized instance of `Never`. If this affects you, please read Porting.md!) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent aee0821 commit 6783a1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Testing/Support/Locked.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ struct Locked<T>: RawRepresentable, Sendable where T: Sendable {
4444
typealias PlatformLock = SRWLOCK
4545
#elseif os(WASI)
4646
// No locks on WASI without multithreaded runtime.
47-
typealias PlatformLock = Void
47+
typealias PlatformLock = Never
4848
#else
4949
#warning("Platform-specific implementation missing: locking unavailable")
50-
typealias PlatformLock = Void
50+
typealias PlatformLock = Never
5151
#endif
5252

5353
/// A type providing heap-allocated storage for an instance of ``Locked``.

0 commit comments

Comments
 (0)