mirror of
https://github.com/apple/swift-nio
synced 2026-11-22 04:30:41 +00:00
Drop `@unchecked` from `TokenBucket`'s `Sendable` conformance. ### Motivation: `TokenBucket` (in both `NIOFS` and `_NIOFileSystem`) is marked `@unchecked Sendable`, but its only stored property is `private let lock: NIOLockedValueBox<State>`, and `NIOLockedValueBox` is `Sendable` when its value is (`State` holds an `Int` and a `Deque<CheckedContinuation<Void, Never>>`). The compiler can verify this conformance on its own, and keeping `@unchecked` means it would not catch a future change that breaks sendability. ### Modifications: - Replace `@unchecked Sendable` with `Sendable` on `TokenBucket` in `NIOFS` and `_NIOFileSystem`. ### Result: No behavior change; the conformance is now checked by the compiler. Verified locally on macOS (Swift 6.4.2): `swift build --build-tests -Xswiftc -strict-concurrency=complete` produces no new diagnostics, and `NIOFSTests`, `NIOFSIntegrationTests` and `NIOFSFoundationCompatTests` pass.