mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
setOption forms a raw pointer to a generic argument. The compiler will warn on this as of: [proposal] Constrain implicit raw pointer conversion... #1963 https://github.com/apple/swift-evolution/pull/1963 /Sources/NIOPosix/BaseSocket.swift:286:31: warning: forming 'UnsafeRawPointer' to a variable of type 'T'; this is likely incorrect because 'T' may contain an object reference. option_value: &val, ^ Ideally, this would be fixed by adding a BitwiseCopyable constraint to the 'value' parameter of 'BaseSocker.setOption'. That would not only eliminate the warning, but would make the API safer. But BitwiseCopyable isn't quite ready for public use. In the meantime, this is a reasonable workaround. Co-authored-by: Cory Benfield <lukasa@apple.com>